Switch between battery charging/not icons

This commit is contained in:
Kenneth Benzie 2023-06-02 19:31:14 +01:00
parent b5c2f8343a
commit 41cb522d2c

View File

@ -24,11 +24,18 @@ fi
if [ "`acpi -b`" != "No support for device type: power_supply" ]; then
function get_battery {
acpi -b | \
awk '{ print $4 }' | \
awk '$battery ~ /.*/ {
local output=$(acpi -b)
local charging=$(echo $output | awk '{ print $3 }')
local percentage=$(echo $output | awk '{ print $4 }')
if [ "$charging" = "Charging," ];then
echo $percentage | awk '$battery ~ /.*/ {
printf "%3d%% %s\n", $battery, substr("󰢟󰢜󰂆󰂇󰂈󰢝󰂉󰢞󰂊󰂋󰂅", int($battery / 9), 1)
}'
else
echo $percentage | awk '$battery ~ /.*/ {
printf "%3d%% %s\n", $battery, substr("󰂎󰁺󰁻󰁼󰁽󰁾󰁿󰂀󰂁󰂂󰁹", int($battery / 9), 1)
}'
fi
}
else
function get_battery {