Add edge catching for when the battery is charging

This commit is contained in:
Tanguy Herbron 2020-08-02 16:29:04 +02:00
parent 7605593b81
commit 4d7d69af84

View File

@ -1,6 +1,13 @@
#!/bin/bash
battery_level=$(acpi -b | grep -P -o -m1 "[0-9]+(?=%)")
charging_state=$(acpi -b | grep -P -o -m1 "([A-Z])\w+,")
# If laptop is charging, do not make further tests
if [ $charging_state = "Charging," ]
then
exit
fi
if [ $battery_level -le 5 ]
then