chezmoi/scripts/executable_battery_notification.sh

14 lines
229 B
Bash

#!/usr/bin/bash
export DISPLAY=:0
CAPACITY=$(cat /sys/class/power_supply/BAT0/capacity)
if [[ $CAPACITY -lt 20 ]]
then
MSG="Battery low: $CAPACITY%";
else
MSG="Battery high: $CAPACITY%";
fi
/usr/bin/notify-send "$MSG"