fix: only notify low baterry when on BAT0

This commit is contained in:
David JULIEN 2021-09-23 23:32:27 +02:00
parent edcfdc2078
commit e8d6a02c00

View File

@ -25,8 +25,8 @@ notify() { \
fi
[ 300 -gt $delta ] && return;
echo $now > $XDG_CONFIG_HOME/batteryupdate
case "$total" in
[2-3][0-9]) notify-send -u "normal" "Battery is running low ($capacity%)" "Please plug your computer to a power source" ;;
case "$capacity" in
2[0-9]) notify-send -u "normal" "Battery is running low ($capacity%)" "Please plug your computer to a power source" ;;
*) notify-send -u "critical" "Battery is dangerously low ($capacity%)" "Please plug your computer to a power source - <b>NOW!</b>" ;;
esac
}
@ -51,7 +51,7 @@ do
[2-3][0-9]) status="" ;;
*) status="" ;;
esac
[ 40 -gt $total ] && notify;
[ "BAT0" = $slot ] && [ 30 -gt $capacity ] && notify;
fi
printf " %s:%s (%0.2d%%) " "$slot" "$status" "$capacity";
fi