aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJozanLeClerc <bousset.rudy@gmail.com>2019-11-15 11:38:59 +0100
committerJozanLeClerc <bousset.rudy@gmail.com>2019-11-15 11:38:59 +0100
commit4e167afa53ccff0a4467a75709a2276c5156f92b (patch)
treedb79aca97c886d5e4df4825075743cc866a78573
parentBetter formatting (diff)
downloadlowbat-gnu-4e167afa53ccff0a4467a75709a2276c5156f92b.tar.gz
lowbat-gnu-4e167afa53ccff0a4467a75709a2276c5156f92b.tar.bz2
lowbat-gnu-4e167afa53ccff0a4467a75709a2276c5156f92b.tar.xz
lowbat-gnu-4e167afa53ccff0a4467a75709a2276c5156f92b.tar.zst
lowbat-gnu-4e167afa53ccff0a4467a75709a2276c5156f92b.zip
shellchecked
-rwxr-xr-xbin/lowbat8
1 files changed, 4 insertions, 4 deletions
diff --git a/bin/lowbat b/bin/lowbat
index 8297032..bccf7d2 100755
--- a/bin/lowbat
+++ b/bin/lowbat
@@ -8,19 +8,19 @@ if [ ! "$1" = "--silent" ]; then
fi
fi
-notify() {
+ntf() {
notify-send "Low battery: $batlvl%" "Please plug in computer" -u critical -t 15000
if [ ! "$message" = "--silent" ]; then
echo "$message" | espeak
fi
}
-while [ 1 ]; do
+while true ; do
acstat=$(acpi | awk '{print $3}' | rev | cut -c 2- | rev)
batlvl=$(acpi | awk '{print $4}' | rev | cut -c 3- | rev)
- if [ $batlvl -lt 15 ]; then
+ if [ "$batlvl" -lt 115 ]; then
while [ "$acstat" = "Discharging" ]; do
- $(notify)
+ ntf
sleep 20
acstat=$(acpi | awk '{print $3}' | rev | cut -c 2- | rev)
batlvl=$(acpi | awk '{print $4}' | rev | cut -c 3- | rev)