2019-03-24 22:29:37 -07:00
|
|
|
#!/usr/bin/env sh
|
2019-03-17 00:09:15 -07:00
|
|
|
|
2021-05-15 23:02:01 +05:30
|
|
|
# Description: Send the selected files to your Android device using kdeconnect-cli.
|
|
|
|
# kdeconnect must be configured on the Android device and the PC.
|
2019-03-17 00:09:15 -07:00
|
|
|
#
|
2019-03-24 22:29:37 -07:00
|
|
|
# Shell: POSIX compliant
|
2019-03-17 00:09:15 -07:00
|
|
|
# Author: juacq97
|
|
|
|
|
2020-04-24 10:12:24 +05:30
|
|
|
selection=${NNN_SEL:-${XDG_CONFIG_HOME:-$HOME/.config}/nnn/.selection}
|
2019-04-21 23:59:51 +05:30
|
|
|
|
2019-03-17 00:09:15 -07:00
|
|
|
id=$(kdeconnect-cli -a --id-only | awk '{print $1}')
|
2021-03-27 17:07:58 +05:30
|
|
|
if [ -s "$selection" ]; then
|
2020-04-24 10:12:24 +05:30
|
|
|
kdeconnect-cli -d "$id" --share "$(cat "$selection")"
|
2020-12-12 20:53:00 +05:30
|
|
|
|
|
|
|
# If you want a system notification, uncomment the next 3 lines.
|
|
|
|
#notify-send -a "Kdeconnect" "Sending $(cat "$selection")"
|
2019-03-24 23:24:34 -07:00
|
|
|
#else
|
2020-12-12 20:53:00 +05:30
|
|
|
#notify-send -a "Kdeconnect" "No file selected"
|
2021-03-27 17:07:58 +05:30
|
|
|
|
|
|
|
# Clear selection
|
|
|
|
if [ -p "$NNN_PIPE" ]; then
|
|
|
|
printf "-" > "$NNN_PIPE"
|
|
|
|
fi
|
2019-03-17 00:09:15 -07:00
|
|
|
fi
|