dotfiles/script/tmbatinfo

16 lines
306 B
Bash
Executable File

#!/usr/bin/env bash
#
# Print battery percentage to stdout
set -e
pc=$(batinfo)
if [ "$pc" -gt 40 ]; then
echo "#[fg=black, bg=green] $(batinfo)% #[default]"
elif [ "$pc" -gt 10 ]; then
echo "#[fg=black, bg=yellow] $(batinfo)% #[default]"
else
echo "#[fg=black, bg=red] $(batinfo)% #[default]"
fi