aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xenv/.local/bin/notify_low_battery.sh3
1 files changed, 2 insertions, 1 deletions
diff --git a/env/.local/bin/notify_low_battery.sh b/env/.local/bin/notify_low_battery.sh
index e0e6f84..6918165 100755
--- a/env/.local/bin/notify_low_battery.sh
+++ b/env/.local/bin/notify_low_battery.sh
@@ -1,4 +1,5 @@
#!/bin/sh
CAPACITY=$(cat /sys/class/power_supply/BAT0/capacity)
-[ $CAPACITY -lt 20 ] && notify-send --urgency=critical "Low battery" "Less then $CAPACITY% remaining.\n Charge your laptop."
+ONLINE=$(cat /sys/class/power_supply/ADP1/online)
+[ $CAPACITY -lt 100 ] && [ $ONLINE -eq 0 ] && notify-send --urgency=critical "Low battery" "Less then $CAPACITY% remaining.\n Charge your laptop."