dotfiles/scripts/battery.sh

7 lines
204 B
Bash
Raw Normal View History

2021-12-09 19:20:02 +00:00
#!/bin/bash
percent=$(cat /sys/class/power_supply/BAT0/capacity)
charging=$(cat /sys/class/power_supply/BAT0/status | grep "^C")
[ -z "$charging" ] && status=" " || status="*"
echo $percent"% [$status]"