diff options
Diffstat (limited to '.config/eww/scripts/battery')
-rwxr-xr-x | .config/eww/scripts/battery | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/.config/eww/scripts/battery b/.config/eww/scripts/battery new file mode 100755 index 0000000..0db4adb --- /dev/null +++ b/.config/eww/scripts/battery @@ -0,0 +1,37 @@ +#!/bin/sh + +set -e + +acpi | awk ' + { + sub(/Battery [0-9]+: /, "") + FS = "[, ]+" + n = NF + sub(/%$/, "", $n) + printf "percentage=%d%%\n", $n + printf "icon=" + $n = int($n) + if ($1 == "Charging") + print "" + else if ($n >= 90) + print "" + else if ($n >= 80) + print "" + else if ($n >= 70) + print "" + else if ($n >= 60) + print "" + else if ($n >= 50) + print "" + else if ($n >= 40) + print "" + else if ($n >= 30) + print "" + else if ($n >= 20) + print "" + else if ($n >= 10) + print "" + else + print "" + }' \ + | jo |