nixos/home/hyprland/ironbar/reference/scripts/battery

16 lines
265 B
Plaintext
Raw Normal View History

2023-10-10 20:00:04 +01:00
#!/usr/bin/env bash
BAT=$(ls /sys/class/power_supply | grep BAT | head -n 1)
battery() {
cat /sys/class/power_supply/${BAT}/capacity
}
battery_stat() {
cat /sys/class/power_supply/${BAT}/status
}
case "$1" in
--bat) battery ;;
--bat-st) battery_stat ;;
esac