summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorShubham Saini <shubham6405@gmail.com>2020-04-04 13:34:28 +0000
committerShubham Saini <shubham6405@gmail.com>2020-04-04 13:34:28 +0000
commit2813a43bda44a4ade58a6b95f4d16935a96b0f66 (patch)
treec29254d602eece1b6963912d35b20a87a32b19c2 /bin
parent91e9c808a0f2b01b67c32a3603626dac0cf90d49 (diff)
less bloat
Diffstat (limited to 'bin')
-rwxr-xr-xbin/.local/bin/bat_check.sh13
-rwxr-xr-xbin/.local/bin/shut8
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
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
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 @@
3RET=$(echo -e "shutdown\nreboot\nsleep\nlock\ncancel" | dmenu -l 5 -p "Sayonara") 3RET=$(echo -e "shutdown\nreboot\nsleep\nlock\ncancel" | dmenu -l 5 -p "Sayonara")
4 4
5case $RET in 5case $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 *) ;;
11esac 11esac