awesomewm/modules/battery/battery.fish

9 lines
448 B
Fish
Executable File

#!/usr/bin/fish
# returns battery percentage and status
# 45%, discharging
# second parameter returns "fully" when fully charged. Since awesome only checks for "discharging," fixing that isn't necessary.
echo \
(upower --show-info /org/freedesktop/UPower/devices/battery_BAT1 | grep percentage | grep -Po "(\d\d?\d?)%"), \
(upower --show-info /org/freedesktop/UPower/devices/battery_BAT1 | grep state | grep -Po "(?<=state:)\s*(\w*)" | xargs) \