diff options
-rwxr-xr-x | .config/eww/scripts/battery | 29 |
1 files changed, 12 insertions, 17 deletions
diff --git a/.config/eww/scripts/battery b/.config/eww/scripts/battery index 0db4adb..9905949 100755 --- a/.config/eww/scripts/battery +++ b/.config/eww/scripts/battery @@ -2,36 +2,31 @@ set -e -acpi | awk ' +awk ' { - sub(/Battery [0-9]+: /, "") - FS = "[, ]+" - n = NF - sub(/%$/, "", $n) - printf "percentage=%d%%\n", $n + printf "percentage=%d%%\n", $0 printf "icon=" - $n = int($n) if ($1 == "Charging") print "" - else if ($n >= 90) + else if ($0 >= 90) print "" - else if ($n >= 80) + else if ($0 >= 80) print "" - else if ($n >= 70) + else if ($0 >= 70) print "" - else if ($n >= 60) + else if ($0 >= 60) print "" - else if ($n >= 50) + else if ($0 >= 50) print "" - else if ($n >= 40) + else if ($0 >= 40) print "" - else if ($n >= 30) + else if ($0 >= 30) print "" - else if ($n >= 20) + else if ($0 >= 20) print "" - else if ($n >= 10) + else if ($0 >= 10) print "" else print "" - }' \ + }' /sys/class/power_supply/BAT1/capacity \ | jo |