From d82cce5433304882442bcb4c3910ac2187699785 Mon Sep 17 00:00:00 2001 From: Thomas Voss Date: Wed, 23 Aug 2023 19:27:00 +0300 Subject: eww: Read from /sys directly --- .config/eww/scripts/battery | 29 ++++++++++++----------------- 1 file 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 -- cgit v1.2.3