commit 08ceb8f7075e29d3d4e02c0119a0ac1450541af6
parent a2f45b6c4270ca1b697fb78ba3ebe062982e5454
Author: pyratebeard <root@pyratebeard.net>
Date: Wed, 6 Mar 2019 20:37:14 +0000
add status check, exit unless batt is discharging
Diffstat:
1 file changed, 5 insertions(+), 0 deletions(-)
diff --git a/check-batt b/check-batt
@@ -1,5 +1,6 @@
#!/usr/bin/env bash
+BATTSTATUS=$(cat /sys/class/power_supply/BAT0/status)
BATTPERC=$(cat /sys/class/power_supply/BAT0/capacity)
notify() {
@@ -8,6 +9,10 @@ notify() {
DISPLAY=:0 /usr/bin/notify-send -u "$level" "POWER" "$msg"
}
+if [[ $BATTSTATUS != 'Discharging' ]] ; then
+ exit 0
+fi
+
if [[ $BATTPERC == 50 ]] ; then
notify "low" "battery is at 50%"
elif [[ $BATTPERC == 30 ]] ; then