dwm-status-bar-freebsd/battery
2023-05-30 10:01:34 +02:00

31 lines
498 B
Bash
Executable File

#!/bin/sh
STATUS=$(sysctl -nh hw.acpi.battery.state)
LOAD=$(sysctl -nh hw.acpi.battery.life)
if [ $STATUS = 2 ]
then
# cargando
echo$LOAD%
elif [ $STATUS = 1 ]
then
#descargando
if [ $LOAD -lt 6 ]
then
echo$LOAD%
elif [ $LOAD -lt 26 ]
then
echo$LOAD%
elif [ $LOAD -lt 56 ]
then
echo$LOAD%
elif [ $LOAD -lt 81 ]
then
echo$LOAD%
else
echo$LOAD%
fi
else
echo$LOAD%
fi