neodotfiles/user/.config/suckless/dwmblocks/scripts/block_battery

14 lines
386 B
Text
Raw Normal View History

2022-12-20 00:15:21 +00:00
#!/bin/bash
# Loop through all attached batteries and format the info
currntpwr=$(powerprofilesctl get)
if [ "${currntpwr}" = "performance" ]; then
pwr="perf"
elif [ "${currntpwr}" = "balanced" ]; then
pwr="balc"
elif [ "${currntpwr}" = "power-saver" ]; then
pwr="pwrs"
fi
battery="/sys/class/power_supply/BAT0"
capacity=$(cat "$battery"/capacity)
echo -e " bat: $capacity% - $pwr "