Skip to content

Commit

Permalink
Adjustments for battery monitor
Browse files Browse the repository at this point in the history
  • Loading branch information
b3nj5m1n committed Oct 13, 2023
1 parent 1e5c550 commit 29ba4a5
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions scripts/bsod.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@
# exit 1
# fi

# # Check if battery level is below 60%
# battery_level=$(cat /sys/class/power_supply/BAT0/capacity)
# if [ "$battery_level" -gt 60 ]; then
# exit
# fi
# Check if battery level is below 60%
battery_level=$(cat /sys/class/power_supply/BAT0/capacity)
if [ "$battery_level" -gt 50 ]; then
exit
fi

# Check if battery is discharging
battery_status=$(cat /sys/class/power_supply/BAT0/status)
Expand All @@ -26,7 +26,12 @@ echo -e "\033c" | tee /dev/tty4
cols=$(stty -F /dev/tty4 size | cut -d' ' -f2)
rows=$(stty -F /dev/tty4 size | cut -d' ' -f1)

# Turn background blue
printf "\033[44m" | tee /dev/tty4
# Unless the battery is really low, in which case it should be red
if [ "$battery_level" -lt 20 ]; then
echo -e "\033[41m" | tee /dev/tty4
fi

x="$rows"
y="$cols"
Expand Down

0 comments on commit 29ba4a5

Please sign in to comment.