aboutsummaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
authorJozanLeClerc <bousset.rudy@gmail.com>2019-11-14 01:12:51 +0100
committerJozanLeClerc <bousset.rudy@gmail.com>2019-11-14 01:12:51 +0100
commit64846dd31ecdd151cfa791742c9bf385d4f0b6e1 (patch)
treee7671da88eb31d3539d4b54f047b1bba32b1dd6e /bin
parentFinished Makefile (diff)
downloadlowbat-gnu-64846dd31ecdd151cfa791742c9bf385d4f0b6e1.tar.gz
lowbat-gnu-64846dd31ecdd151cfa791742c9bf385d4f0b6e1.tar.bz2
lowbat-gnu-64846dd31ecdd151cfa791742c9bf385d4f0b6e1.tar.xz
lowbat-gnu-64846dd31ecdd151cfa791742c9bf385d4f0b6e1.tar.zst
lowbat-gnu-64846dd31ecdd151cfa791742c9bf385d4f0b6e1.zip
Suppressed all bashisms
Diffstat (limited to 'bin')
-rwxr-xr-xbin/lowbat18
1 files changed, 10 insertions, 8 deletions
diff --git a/bin/lowbat b/bin/lowbat
index 3a31f0b..a2ebafb 100755
--- a/bin/lowbat
+++ b/bin/lowbat
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/dash
notify() {
notify-send "Low battery" "Please plug in computer" -u critical -t 15000
@@ -8,13 +8,15 @@ notify() {
while [ 1 ]; do
acstat=$(acpi | awk '{print $3}' | rev | cut -c 2- | rev)
batlvl=$(acpi | awk '{print $4}' | rev | cut -c 3- | rev)
- while [[ $acstat == "Discharging" && $batlvl -lt 25 ]]; do
- $(notify)
- sleep 20
- acstat=$(acpi | awk '{print $3}' | rev | cut -c 2- | rev)
- batlvl=$(acpi | awk '{print $4}' | rev | cut -c 3- | rev)
- if [[ $acstat == "Charging" ]]; then
- break
+ while [ "$acstat" = "Discharging" ]; do
+ if [ $batlvl -lt 15 ]; then
+ $(notify)
+ sleep 20
+ acstat=$(acpi | awk '{print $3}' | rev | cut -c 2- | rev)
+ batlvl=$(acpi | awk '{print $4}' | rev | cut -c 3- | rev)
+ if [ "$acstat" = "Charging" ]; then
+ break
+ fi
fi
done
sleep 240