Files
nixos/Droidnix/generated/.config/scripts/kdeconnect-status.sh
T
2026-04-20 20:05:41 +02:00

11 lines
414 B
Bash
Executable File

#!/usr/bin/env bash
# --- This file has been auto-generated. For permanent changes alter the appropriate block in the README.org. ---
DEVICE=$(kdeconnect-cli --list-devices | awk -F: '/Device ID/ {print $2; exit}' | xargs)
if [ -z "$DEVICE" ]; then
echo "No phone"
exit 0
fi
NAME=$(kdeconnect-cli -d "$DEVICE" --name)
BATTERY=$(kdeconnect-cli -d "$DEVICE" --battery | grep -o '[0-9]\+')
echo "$NAME $BATTERY%"