Debian Codegraph @

plugins/gsconnect

raw
1 #!/usr/bin/env sh
2
3 #set -x
4 # Description: Send the selected (or hovered) files to your Android device using gsconnect daemon.js.
5 # GSConnect must be configured on the Android device and the PC.
6 #
7 # Shell: POSIX compliant
8 # Author: Darukutsu
9 selection=${NNN_SEL:-${XDG_CONFIG_HOME:-$HOME/.config}/nnn/.selection}
10 gsconnect=$HOME/.local/share/gnome-shell/extensions/[email protected]/service/daemon.js
11 ids=$($gsconnect -l)
12
13 for id in $ids; do
14 if [ -s "$selection" ]; then
15 xargs -0 < "$selection" -I{} "$gsconnect" -d "$id" --share-file="{}"
16 # Clear selection
17 printf "-" > "$NNN_PIPE"
18 else
19 "$gsconnect" -d "$id" --share-file="$2/$1"
20 fi
21 done