2022-11-01 00:48:17 +00:00
|
|
|
#!/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
|
2023-05-19 12:33:24 +01:00
|
|
|
echo "<fn=3> </fn> <fc=#AAC0F0> $batLevel%</fc>"
|
2022-11-01 00:48:17 +00:00
|
|
|
else
|
2023-05-19 12:33:24 +01:00
|
|
|
echo "<fn=4> </fn> <fc=#AAC0F0> $batLevel%</fc>"
|
2022-11-01 00:48:17 +00:00
|
|
|
fi
|
|
|
|
elif [ $batLevel -le 30 ];
|
|
|
|
then
|
|
|
|
if [ $charging == "on-line" ];
|
|
|
|
then
|
2023-05-19 12:33:24 +01:00
|
|
|
echo "<fn=3> </fn> <fc=#AAC0F0> $batLevel%</fc>"
|
2022-11-01 00:48:17 +00:00
|
|
|
else
|
2023-05-19 12:33:24 +01:00
|
|
|
echo "<fn=4> </fn> <fc=#AAC0F0> $batLevel%</fc>"
|
2022-11-01 00:48:17 +00:00
|
|
|
fi
|
|
|
|
elif [ $batLevel -le 40 ];
|
|
|
|
then
|
|
|
|
if [ $charging == "on-line" ];
|
|
|
|
then
|
2023-05-19 12:33:24 +01:00
|
|
|
echo "<fn=3> </fn> <fc=#AAC0F0> $batLevel%</fc>"
|
2022-11-01 00:48:17 +00:00
|
|
|
else
|
2023-05-19 12:33:24 +01:00
|
|
|
echo "<fn=3> </fn> <fc=#AAC0F0> $batLevel%</fc>"
|
2022-11-01 00:48:17 +00:00
|
|
|
fi
|
|
|
|
elif [ $batLevel -le 60 ];
|
|
|
|
then
|
|
|
|
if [ $charging == "on-line" ];
|
|
|
|
then
|
2023-05-19 12:33:24 +01:00
|
|
|
echo "<fn=3> </fn> <fc=#AAC0F0> $batLevel%</fc>"
|
2022-11-01 00:48:17 +00:00
|
|
|
else
|
2023-05-19 12:33:24 +01:00
|
|
|
echo "<fn=4> </fn> <fc=#AAC0F0> $batLevel%</fc>"
|
2022-11-01 00:48:17 +00:00
|
|
|
fi
|
|
|
|
elif [ $batLevel -le 80 ];
|
|
|
|
then
|
|
|
|
if [ $charging == "on-line" ];
|
|
|
|
then
|
2023-05-19 12:33:24 +01:00
|
|
|
echo "<fn=3> </fn> <fc=#AAC0F0> $batLevel%</fc>"
|
2022-11-01 00:48:17 +00:00
|
|
|
else
|
2023-05-19 12:33:24 +01:00
|
|
|
echo "<fn=4> </fn> <fc=#AAC0F0> $batLevel%</fc>"
|
2022-11-01 00:48:17 +00:00
|
|
|
fi
|
|
|
|
elif [ $batLevel -le 95 ];
|
|
|
|
then
|
|
|
|
if [ $charging == "on-line" ];
|
|
|
|
then
|
2023-05-19 12:33:24 +01:00
|
|
|
echo "<fn=3> </fn> <fc=#AAC0F0> $batLevel%</fc>"
|
2022-11-01 00:48:17 +00:00
|
|
|
else
|
2023-05-19 12:33:24 +01:00
|
|
|
echo "<fn=4> </fn> <fc=#AAC0F0> $batLevel%</fc>"
|
2022-11-01 00:48:17 +00:00
|
|
|
fi
|
2023-05-19 12:22:02 +01:00
|
|
|
else
|
2022-11-01 00:48:17 +00:00
|
|
|
if [ $charging == "on-line" ];
|
|
|
|
then
|
2023-05-19 12:33:24 +01:00
|
|
|
echo "<fn=3></fn> <fc=#AAC0F0> $batLevel%</fc>"
|
2022-11-01 00:48:17 +00:00
|
|
|
else
|
2023-05-19 12:33:24 +01:00
|
|
|
echo "<fn=4></fn> <fc=#AAC0F0> $batLevel%</fc>"
|
2022-11-01 00:48:17 +00:00
|
|
|
fi
|
|
|
|
fi
|