nixos/system/home/scripts/shell/low-battery.sh

5 lines
172 B
Bash
Raw Normal View History

battery_level=$(acpi -b | grep -P -o '[0-9]+(?=%)')
if [ "$battery_level" -le 20 ]; then
notify-send -u critical "Battery low" "Battery level is ${battery_level}%!"
fi