aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoreug-vs <eugene@eug-vs.xyz>2022-10-28 17:07:30 +0300
committereug-vs <eugene@eug-vs.xyz>2022-10-28 17:07:30 +0300
commitc3eccbc772da998d544894ba82a687682f7e20e1 (patch)
tree531d1e13e4f8b1b25a1c01cc68a34f7b328b7480
parentafb22397e1413c2c705ce32773ff0dbfb23e0231 (diff)
downloaddotfiles-c3eccbc772da998d544894ba82a687682f7e20e1.tar.gz
feat(env): notify low-battery when not charging
-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."