dotfiles/scripts/battery.sh

7 lines
204 B
Bash
Raw Normal View History

2021-12-09 20:20:02 +01: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]"