Skip to content

Instantly share code, notes, and snippets.

@stephencelis
Forked from davidcelis/zelda-battery.sh
Created December 18, 2012 01:24
Show Gist options
  • Save stephencelis/4324139 to your computer and use it in GitHub Desktop.
Save stephencelis/4324139 to your computer and use it in GitHub Desktop.
#!/usr/bin/env sh
#
# Works best with blinking text: the last heart will blink when you have less
# than 25% of your battery life remaining.
#
# Add the following to your `~/.tmux.conf`;
#
# set -g status-right "#[fg=red]#(path/to/zelda-battery-tmux.sh) "
battery="$(pmset -g ps | awk 'NR==2' | perl -pe 's/.*?(\d+)%.*/\1/')"
if [[ $battery -lt 25 ]]; then
echo "#[blink]♥#[noblink]♡♡"
elif [[ $battery -lt 50 ]]; then
echo "♥♡♡"
elif [[ $battery -lt 75 ]]; then
echo "♥♥♡"
else
echo "♥♥♥"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment