nixrice/.local/bin/block_battery
2024-02-20 21:10:52 -05:00

22 lines
412 B
Bash
Executable file

#!/bin/sh
battery=/sys/class/power_supply/BAT0
capacity=$(cat $battery/capacity)
bstatus=$(cat $battery/status)
if [ "$bstatus" = "Charging" ]; then
symbol=󰂄
elif [ $capacity -gt 80 ]; then
symbol=
elif [ $capacity -gt 60 ]; then
symbol=
elif [ $capacity -gt 40 ]; then
symbol=
elif [ $capacity -gt 20 ]; then
symbol=
else
symbol=
fi
echo "${symbol} ${capacity}%"