summaryrefslogtreecommitdiff
path: root/bin/.local/bin/bat_check.sh
diff options
context:
space:
mode:
Diffstat (limited to 'bin/.local/bin/bat_check.sh')
-rwxr-xr-xbin/.local/bin/bat_check.sh13
1 files changed, 13 insertions, 0 deletions
diff --git a/bin/.local/bin/bat_check.sh b/bin/.local/bin/bat_check.sh
new file mode 100755
index 0000000..b54ce7b
--- /dev/null
+++ b/bin/.local/bin/bat_check.sh
@@ -0,0 +1,13 @@
1#!/bin/bash
2while true
3do
4 battery_level=$(cat /sys/class/power_supply/BAT0/capacity)
5 if [ $battery_level -ge 95 ]; then
6 notify-send 'Pull the plug!' $battery_level%
7 elif [ $battery_level -le 30 -a $battery_level -ge 20 ]; then
8 notify-send 'Plug me!' $battery_level%
9 elif [ $battery_level -le 20 ]; then
10 notify-send -u critical 'Plug me NOW!' $battery_level%
11 fi
12 sleep 300 # 300 seconds or 5 minutes
13done