nsbin/battery-check.sh

19 lines
409 B
Bash
Raw Normal View History

2019-11-30 16:36:54 +00:00
#!/bin/sh
acpi=$(acpi)
# Nothing to be done if we are charging
if echo "$acpi" | grep -q Charging; then
2019-12-08 18:28:42 +00:00
exit 0
2019-11-30 16:36:54 +00:00
fi
percent=$(echo $acpi | cut -d, -f2 | sed 's/%//')
if [ $percent -le 10 ]; then
notify-send -u critical "Battery:${percent}%"
elif [ $percent -le 15 ]; then
notify-send -u normal "Battery:${percent}%"
elif [ $percent -le 20 ]; then
notify-send -u low "Battery:${percent}%"
fi