diff options
author | Shubham Saini <pryr@pryr.xyz> | 2021-05-22 19:18:51 +0000 |
---|---|---|
committer | Shubham Saini <pryr@pryr.xyz> | 2021-05-22 19:18:51 +0000 |
commit | 72ccd83ccc66d942b855fe8379bc3f0d24384b76 (patch) | |
tree | 515997e25fb736ee1e3481dc941c1b540c03624b /bin/.bin/bat_check | |
parent | bde9d8e1c9a6e2213fc7d40298d43a14f2e99359 (diff) |
improved scripts
Diffstat (limited to 'bin/.bin/bat_check')
-rwxr-xr-x | bin/.bin/bat_check | 14 |
1 files changed, 0 insertions, 14 deletions
diff --git a/bin/.bin/bat_check b/bin/.bin/bat_check deleted file mode 100755 index 547b976..0000000 --- a/bin/.bin/bat_check +++ /dev/null | |||
@@ -1,14 +0,0 @@ | |||
1 | #!/bin/bash | ||
2 | while true | ||
3 | do | ||
4 | battery_level=$(cat /sys/class/power_supply/BAT0/capacity) | ||
5 | state=$(cat /sys/class/power_supply/BAT0/status) | ||
6 | if [ $battery_level -ge 90 ] && [ $state == "Charging" ]; then | ||
7 | notify-send 'Pull the plug!' $battery_level% | ||
8 | elif [ $battery_level -le 30 -a $battery_level -ge 20 ] && [ $state == "Discharging" ]; then | ||
9 | notify-send 'Plug me!' $battery_level% | ||
10 | elif [ $battery_level -le 20 ] && [ $state == "Discharging" ]; then | ||
11 | notify-send -u critical 'Plug me NOW!' $battery_level% | ||
12 | fi | ||
13 | sleep 300 # 300 seconds or 5 minutes | ||
14 | done | ||