diff options
author | Shubham Saini <shubham6405@gmail.com> | 2020-04-04 13:34:28 +0000 |
---|---|---|
committer | Shubham Saini <shubham6405@gmail.com> | 2020-04-04 13:34:28 +0000 |
commit | 2813a43bda44a4ade58a6b95f4d16935a96b0f66 (patch) | |
tree | c29254d602eece1b6963912d35b20a87a32b19c2 /bin | |
parent | 91e9c808a0f2b01b67c32a3603626dac0cf90d49 (diff) |
less bloat
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/.local/bin/bat_check.sh | 13 | ||||
-rwxr-xr-x | bin/.local/bin/shut | 8 |
2 files changed, 17 insertions, 4 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 | ||
2 | while true | ||
3 | do | ||
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 | ||
13 | done | ||
diff --git a/bin/.local/bin/shut b/bin/.local/bin/shut index 88711d1..527dfb1 100755 --- a/bin/.local/bin/shut +++ b/bin/.local/bin/shut | |||
@@ -3,9 +3,9 @@ | |||
3 | RET=$(echo -e "shutdown\nreboot\nsleep\nlock\ncancel" | dmenu -l 5 -p "Sayonara") | 3 | RET=$(echo -e "shutdown\nreboot\nsleep\nlock\ncancel" | dmenu -l 5 -p "Sayonara") |
4 | 4 | ||
5 | case $RET in | 5 | case $RET in |
6 | shutdown) doas poweroff ;; | 6 | shutdown) sudo poweroff ;; |
7 | reboot) doas reboot ;; | 7 | reboot) sudo reboot ;; |
8 | sleep) /home/fd0e/.local/bin/lock & doas sh -c "echo -n mem > /sys/power/state" ;; | 8 | sleep) /home/fd0e/.local/bin/lock & sudo sh -c "echo -n mem > /sys/power/state" ;; |
9 | lock) /home/fd0e/.local/bin/lock ;; | 9 | lock) /home/fd0e/.local/bin/lock ;; |
10 | *) ;; | 10 | *) ;; |
11 | esac | 11 | esac |