summaryrefslogtreecommitdiff
path: root/checkbattery
diff options
context:
space:
mode:
Diffstat (limited to 'checkbattery')
-rwxr-xr-xcheckbattery15
1 files changed, 15 insertions, 0 deletions
diff --git a/checkbattery b/checkbattery
new file mode 100755
index 0000000..5b4cfe6
--- /dev/null
+++ b/checkbattery
@@ -0,0 +1,15 @@
+#!/usr/bin/env bash
+
+export DISPLAY=:0
+
+BATT=`acpi -b | grep -P -o '[0-9]+(?=%)'`
+TIME=`acpi -b | grep -P -o '[0-9]{2}:[0-9]{2}:[0-9]{2}'`
+
+if (( $BATT < 10 ))
+then
+ notify-send -u critical "LOW BATTERY!" "\
+Battery Charge: ${BATT}%
+Time Remaining: ${TIME}"
+fi
+
+exit 0