aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xbin/lowbat13
1 files changed, 8 insertions, 5 deletions
diff --git a/bin/lowbat b/bin/lowbat
index 48a6a38..765d818 100755
--- a/bin/lowbat
+++ b/bin/lowbat
@@ -1,20 +1,23 @@
#!/bin/sh
-if [ $# -lt 2 ]; then
+if [ $# -lt 1 ]; then
message="beep beep - low battery"
else
- message=$2
+ message=$1
fi
notify() {
- notify-send "Low battery" "Please plug in computer" -u critical -t 15000
- echo $message | espeak
+ notify-send "Low battery: $batlvl%" "Please plug in computer" -u critical -t 15000
+ if [ "$message" = "no-audio" ]; then
+ else
+ echo "$message" | espeak
+ fi
}
while [ 1 ]; 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)
sleep 20