dotfiles/.config/xmobar/scripts/battery.sh
afonsofrancof f6b77a9118 Icon fixes
2022-11-01 01:13:27 +00:00

64 lines
1 KiB
Bash
Executable file

#!/bin/bash
batLevel=$(acpi --battery | grep -Po '(\d+)\%' | sed 's/%//')
charging=$(acpi --ac-adapter | grep -Po '(off-line|on-line)')
if [ $batLevel -le 20 ];
then
if [ $charging == "on-line" ];
then
echo "<fn=3> </fn>"
else
echo "<fn=4> </fn>"
fi
elif [ $batLevel -le 30 ];
then
if [ $charging == "on-line" ];
then
echo "<fn=3> </fn>"
else
echo "<fn=4> </fn>"
fi
elif [ $batLevel -le 40 ];
then
if [ $charging == "on-line" ];
then
echo "<fn=3> </fn>"
else
echo "<fn=3> </fn>"
fi
elif [ $batLevel -le 60 ];
then
if [ $charging == "on-line" ];
then
echo "<fn=3> </fn>"
else
echo "<fn=4> </fn>"
fi
elif [ $batLevel -le 80 ];
then
if [ $charging == "on-line" ];
then
echo "<fn=3> </fn>"
else
echo "<fn=4> </fn>"
fi
elif [ $batLevel -le 95 ];
then
if [ $charging == "on-line" ];
then
echo "<fn=3> </fn>"
else
echo "<fn=4> </fn>"
fi
elif [ $batLevel -g 95 ];
then
if [ $charging == "on-line" ];
then
echo "<fn=3> </fn>"
else
echo "<fn=4> </fn>"
fi
fi