Last active
December 20, 2022 18:16
-
-
Save rc2dev/678adc40cd75f9ea472cd3f77b63d21c to your computer and use it in GitHub Desktop.
Send files to your phone from file manager (https://rafaelc.org/posts/send-files-to-your-phone-from-file-manager/). Previously tracked on my dotfiles repository.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# Send files to phone. | |
# It's a wrapper around KDE Connect CLI to provide | |
# a bit more functionality. | |
# | |
# Copyright (C) 2019-2021 Rafael Cavalcanti <https://rafaelc.org/dev> | |
# Licensed under GPLv3 | |
readonly script_name="$(basename "$0")" | |
if (( $# == 0 )); then | |
printf "Usage: %s file [file...]\n" "$script_name" | |
exit 1 | |
fi | |
readonly phone_id="$(kdeconnect-cli -l --id-only | head -1)" | |
while (( $# > 0 )); do | |
file="$1" | |
base="$(basename -- "$file")" | |
if kdeconnect-cli --device "$phone_id" --share "$file"; then | |
notify-send --urgency=normal "$script_name" "File sent: $base" | |
else | |
notify-send --urgency=critical "$script_name" "Failed to send file: $base" | |
fi | |
shift | |
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Nemo Action] | |
Name=Send to Phone | |
Comment=Send file to phone via KDE Connect | |
Exec=send2phone %F | |
Dependencies=send2phone; | |
Icon-Name=phone | |
Selection=notnone | |
Extensions=nodirs | |
Quote=double |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment