diff --git a/system-info/system-info-Linux.sh b/system-info/system-info-Linux.sh index ed9f468..62e22fc 100755 --- a/system-info/system-info-Linux.sh +++ b/system-info/system-info-Linux.sh @@ -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 ~ /.*/ { - printf "%3d%% %s\n", $battery, substr("󰂎󰁺󰁻󰁼󰁽󰁾󰁿󰂀󰂁󰂂󰁹", int($battery / 9), 1) - }' + 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 {