moonarch/defaults/bin/moonarch-btnote
nevaforget d873985930 fix icon theme references, replace Newaita with Colloid-Catppuccin
- Update gtk-3.0/settings.ini icon theme to match gsettings
- Replace hardcoded Newaita icon path in moonarch-btnote with
  generic icon name (uses active theme automatically)
- Update README to reflect correct icon theme
2026-03-29 14:10:54 +02:00

20 lines
709 B
Bash
Executable File

#!/bin/bash
# ABOUTME: Checks Bluetooth devices for low battery and sends a notification.
# ABOUTME: Can be run periodically via timer or cron.
NOTIFY_AT_PERCENTAGE=70
ICON="battery-empty"
for d in $(upower -e); do
DEVICE_DATA=$(upower -i "$d")
PERCENTAGE=$(echo $DEVICE_DATA | grep -Po '(?<=(percentage: )).*(?= icon)')
PER_INT=$(echo "${PERCENTAGE//%}")
DEVICE_NAME=$(echo $DEVICE_DATA | grep -Po '(?<=(model: )).*(?= serial)')
if [ ! -z "$DEVICE_NAME" ] && [ "$PER_INT" -lt "$NOTIFY_AT_PERCENTAGE" ]; then
notify-send -t 5000 -e "Low battery $DEVICE_NAME $PER_INT%" -i "$ICON" \
-h string:x-canonical-private-synchronous:battery \
-h int:value:"$PER_INT" -u critical
fi
done