2023-06-08 21:19:01 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
#
|
|
|
|
# Print battery percentage to stdout
|
|
|
|
|
|
|
|
set -e
|
|
|
|
|
|
|
|
pc=$(batinfo)
|
|
|
|
|
2023-11-21 08:19:40 +00:00
|
|
|
if [[ "$pc" -gt 40 ]]; then
|
2023-06-08 21:19:01 +00:00
|
|
|
echo "#[fg=black, bg=green] $(batinfo)% #[default]"
|
2023-11-21 08:19:40 +00:00
|
|
|
elif [[ "$pc" -gt 10 ]]; then
|
2023-06-08 21:19:01 +00:00
|
|
|
echo "#[fg=black, bg=yellow] $(batinfo)% #[default]"
|
|
|
|
else
|
|
|
|
echo "#[fg=black, bg=red] $(batinfo)% #[default]"
|
|
|
|
fi
|