mirror of
https://codeberg.org/frosty/dotfiles.git
synced 2024-09-19 11:47:09 -04:00
17 lines
413 B
Plaintext
17 lines
413 B
Plaintext
|
#!/bin/sh
|
||
|
|
||
|
FULL_THRESHOLD=80
|
||
|
FULL_COLOR="#31f53e"
|
||
|
|
||
|
read -r capacity </sys/class/power_supply/BAT1/capacity
|
||
|
read -r status </sys/class/power_supply/BAT1/status
|
||
|
|
||
|
if [ "$capacity" -ge "$FULL_THRESHOLD" ] && [ "$status" = "Not charging" ]; then
|
||
|
status="Full"
|
||
|
fi
|
||
|
if [ "$status" = "Full" ]; then
|
||
|
printf '<fc=%s>%s%%</fc> (%s)\n' "$FULL_COLOR" "$capacity" "$status"
|
||
|
else
|
||
|
printf '%s%% (%s)\n' "$capacity" "$status"
|
||
|
fi
|