Last active
June 17, 2024 13:37
-
-
Save harababurel/f7a7354c4be88fae9d9e620f11e85591 to your computer and use it in GitHub Desktop.
Small script for sending notifications to phone using kde-connect.
This file contains hidden or 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 | |
command -v kdeconnect-cli >/dev/null 2>&1 || { echo >&2 "kdeconnect is not installed. Aborting."; exit 1; } | |
if [ $# -eq 0 ]; then | |
echo "Usage: $0 <message>" | |
exit 1 | |
fi | |
device=`kdeconnect-cli -a --id-only 2>/dev/null | head` | |
if [ "$device" = "" ]; then | |
echo "No paired devices. Will try to search and pair automatically." | |
feedback=`kdeconnect-cli -l | tail -n 1` | |
echo "$feedback." | |
device=`kdeconnect-cli -l --id-only 2>/dev/null | head` | |
if [ "$device" = "" ]; then | |
echo "Stopping." | |
exit 1 | |
fi | |
echo "Trying to pair to $device. Please accept on device." | |
kdeconnect-cli -d $device --pair | |
fi | |
kdeconnect-cli -d $device --ping-msg "$*" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment