From 2813a43bda44a4ade58a6b95f4d16935a96b0f66 Mon Sep 17 00:00:00 2001 From: Shubham Saini Date: Sat, 4 Apr 2020 19:04:28 +0530 Subject: less bloat --- bin/.local/bin/bat_check.sh | 13 +++++++++++++ bin/.local/bin/shut | 8 ++++---- 2 files changed, 17 insertions(+), 4 deletions(-) create mode 100755 bin/.local/bin/bat_check.sh (limited to 'bin/.local') 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 @@ +#!/bin/bash +while true +do + battery_level=$(cat /sys/class/power_supply/BAT0/capacity) + if [ $battery_level -ge 95 ]; then + notify-send 'Pull the plug!' $battery_level% + elif [ $battery_level -le 30 -a $battery_level -ge 20 ]; then + notify-send 'Plug me!' $battery_level% + elif [ $battery_level -le 20 ]; then + notify-send -u critical 'Plug me NOW!' $battery_level% + fi + sleep 300 # 300 seconds or 5 minutes +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 @@ RET=$(echo -e "shutdown\nreboot\nsleep\nlock\ncancel" | dmenu -l 5 -p "Sayonara") case $RET in - shutdown) doas poweroff ;; - reboot) doas reboot ;; - sleep) /home/fd0e/.local/bin/lock & doas sh -c "echo -n mem > /sys/power/state" ;; - lock) /home/fd0e/.local/bin/lock ;; + shutdown) sudo poweroff ;; + reboot) sudo reboot ;; + sleep) /home/fd0e/.local/bin/lock & sudo sh -c "echo -n mem > /sys/power/state" ;; + lock) /home/fd0e/.local/bin/lock ;; *) ;; esac -- cgit v1.2.3