diff options
author | Thomas Voss <mail@thomasvoss.com> | 2023-08-23 19:27:00 +0300 |
---|---|---|
committer | Thomas Voss <mail@thomasvoss.com> | 2023-08-23 19:27:00 +0300 |
commit | d82cce5433304882442bcb4c3910ac2187699785 (patch) | |
tree | f46b7bd9d42069a7046aa2111072cba5867993fc /.config | |
parent | 2ba6e662b2bd2c2018bd78d83b7192d6f10f77a8 (diff) |
eww: Read from /sys directly
Diffstat (limited to '.config')
-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 |