This repository has been archived on 2023-10-17. You can view files and clone it, but cannot push or open issues or pull requests.
dotfiles/.config/nnn/plugins/kdeconnect

25 lines
729 B
Bash
Executable File

#!/usr/bin/env sh
# Description: Send the selected files to your Android device using kdeconnect-cli.
# kdeconnect must be configured on the Android device and the PC.
#
# Shell: POSIX compliant
# Author: juacq97
selection=${NNN_SEL:-${XDG_CONFIG_HOME:-$HOME/.config}/nnn/.selection}
id=$(kdeconnect-cli -a --id-only | awk '{print $1}')
if [ -s "$selection" ]; then
kdeconnect-cli -d "$id" --share "$(cat "$selection")"
# If you want a system notification, uncomment the next 3 lines.
#notify-send -a "Kdeconnect" "Sending $(cat "$selection")"
#else
#notify-send -a "Kdeconnect" "No file selected"
# Clear selection
if [ -p "$NNN_PIPE" ]; then
printf "-" > "$NNN_PIPE"
fi
fi