-
-
Save tiiime/01c1fba0ea5e52a956358986266b6073 to your computer and use it in GitHub Desktop.
Small script for sending notifications to phone using kde-connect.
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 | |
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