summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorShubham Saini <shubham6405@gmail.com>2020-06-03 10:56:37 +0000
committerShubham Saini <shubham6405@gmail.com>2020-06-03 10:56:37 +0000
commit9a334a3d5ffda8aa26302e729fe504dc6400fc1e (patch)
tree6a9dbd97f4f0b0f08aaa9ca9c602544f82d1bd8e /bin
parent93767e79ffd885855b18edbaffaaa27f475cac13 (diff)
changed bat_check
Diffstat (limited to 'bin')
-rwxr-xr-xbin/.local/bin/bat_check.sh9
1 files changed, 5 insertions, 4 deletions
diff --git a/bin/.local/bin/bat_check.sh b/bin/.local/bin/bat_check.sh
index b54ce7b..abfb06f 100755
--- a/bin/.local/bin/bat_check.sh
+++ b/bin/.local/bin/bat_check.sh
@@ -2,12 +2,13 @@
2while true 2while true
3do 3do
4 battery_level=$(cat /sys/class/power_supply/BAT0/capacity) 4 battery_level=$(cat /sys/class/power_supply/BAT0/capacity)
5 if [ $battery_level -ge 95 ]; then 5 state=$(cat /sys/class/power_supply/BAT0/status)
6 if [ $battery_level -ge 95 ] && [ $state == "Discharging" ]; then
6 notify-send 'Pull the plug!' $battery_level% 7 notify-send 'Pull the plug!' $battery_level%
7 elif [ $battery_level -le 30 -a $battery_level -ge 20 ]; then 8 elif [ $battery_level -le 30 -a $battery_level -ge 20 ] && [ $state == "Discharging" ]; then
8 notify-send 'Plug me!' $battery_level% 9 notify-send 'Plug me!' $battery_level%
9 elif [ $battery_level -le 20 ]; then 10 elif [ $battery_level -le 20 ] && [ $state == "Discharging" ]; then
10 notify-send -u critical 'Plug me NOW!' $battery_level% 11 notify-send -u critical 'Plug me NOW!' $battery_level%
11 fi 12 fi
12 sleep 300 # 300 seconds or 5 minutes 13 sleep 2 # 300 seconds or 5 minutes
13done 14done