-
-
Save ConsoleCatzirl/4324384 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env zsh | |
# | |
# Works best with blinking text; the last heart will blink | |
# when you have less than 25% of your battery life remaining. | |
FULL="$(cat /sys/class/power_supply/BAT0/charge_full)" | |
NOW="$(cat /sys/class/power_supply/BAT0/charge_now)" | |
BATTERY=$(echo "scale=25;$NOW/$FULL" | bc) | |
if [[ $BATTERY -lt .25 ]]; then | |
echo "\e[5;31m♥\e[0;31m♡♡\e[0m" | |
elif [[ $BATTERY -lt .50 ]]; then | |
echo "\e[31m♥♡♡\e[0m" | |
elif [[ $BATTERY -lt .75 ]]; then | |
echo "\e[31m♥♥♡\e[0m" | |
else | |
echo "\e[31m♥♥♥\e[0m" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks for the script. Works fine.