Skip to content

Instantly share code, notes, and snippets.

@Ghostbird
Created September 13, 2023 08:10
Show Gist options
  • Save Ghostbird/90cb40fcc6e7b02a7fb5b4c498168bc7 to your computer and use it in GitHub Desktop.
Save Ghostbird/90cb40fcc6e7b02a7fb5b4c498168bc7 to your computer and use it in GitHub Desktop.
Nemo action to send files to single available KDE connect paired device
# Put file in ~/.local/share/nemo/actions/ (single user) or /usr/share/nemo/actions/ (system install)
# Note: This will only work for a single connected KDE connect device.
[Nemo Action]
Active=true
Name=KDE Connect: Send file(s) to device
Comment=Send file(s) to the first found KDE Connect device.
Exec=sh -c 'kdeconnect-cli -d $( kdeconnect-cli --list-available --id-only ) --share %U && notify-send "File(s) transferred to $( kdeconnect-cli --list-available --name-only )" "$( for f in %F; do echo $f; done )" || notify-send "Failed to transfer, device may be offline" "$( for f in %F; do echo $f; done )"'
Icon-Name=kdeconnect
Selection=notnone
Extensions=any;
Quote=double
Dependencies=kdeconnect-cli;notify-send
# Note: kdeconnect-cli --refresh doesn't really ensure the list of available devices is correct.
# The context menu entry will take a while to show up if you've just connected your device,
# and will remain for a little while after you've disconnected it.
Conditions=exec sh -c 'test "$(kdeconnect-cli --refresh --list-available --id-only | wc -l)" = 1'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment