Material Icons.

This commit is contained in:
Bartek Stalewski 2021-07-26 15:56:06 +02:00
parent 9e0d48b35f
commit 4508f38520
13 changed files with 121 additions and 117 deletions

View file

@ -1,19 +1,17 @@
#!/bin/sh
#!/bin/bash
for battery in /sys/class/power_supply/BAT?*; do
# If non-first battery, print a space separator.
[ -n "${capacity+x}" ] && printf " "
# Sets up the status and capacity
case "$(cat "$battery/status")" in
"Full") status="" ;;
"Discharging") status="🔋" ;;
"Charging") status="🔌" ;;
"Not charging") status="🛑" ;;
"Unknown") status="♻️" ;;
"Full") status="\uea0b" ;;
"Discharging") status="\ue1a5" ;;
"Charging") status="\ue63c" ;;
"Not charging") status="\ue1a6" ;;
"Unknown") status="\ue1a3" ;;
esac
capacity=$(cat "$battery/capacity")
# Will make a warn variable if discharging and low
[ "$status" = "🔋" ] && [ "$capacity" -le 25 ] && warn="❗"
# Prints the info
printf "%s %s%d%%" "$status" "$warn" "$capacity"; unset warn
[ "$capacity" -le 20 ] && printf "\ue19c ^c#161616^^b#fd4285^${capacity}%%^d^" || printf "${status} ${capacity}%%"
done && exit 0