++battery check

This commit is contained in:
Nico Schottelius 2019-11-30 17:36:54 +01:00
parent 6131891815
commit 879b537682
1 changed files with 19 additions and 0 deletions

19
battery-check.sh Executable file
View File

@ -0,0 +1,19 @@
#!/bin/sh
acpi=$(acpi)
# Nothing to be done if we are charging
if echo "$acpi" | grep -q Charging; then
# exit 0
:
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