From c3eccbc772da998d544894ba82a687682f7e20e1 Mon Sep 17 00:00:00 2001 From: eug-vs Date: Fri, 28 Oct 2022 17:07:30 +0300 Subject: feat(env): notify low-battery when not charging --- env/.local/bin/notify_low_battery.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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." -- cgit v1.2.3