dotfiles/script/tmbatinfo

16 lines
306 B
Plaintext
Raw Normal View History

2023-06-08 21:19:01 +00:00
#!/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