summaryrefslogtreecommitdiff
path: root/.config/eww/scripts/battery
diff options
context:
space:
mode:
authorThomas Voss <mail@thomasvoss.com> 2023-08-23 06:47:03 +0300
committerThomas Voss <mail@thomasvoss.com> 2023-08-23 06:47:03 +0300
commit7ff798534a6fb9c99611d18ee22757346798ef61 (patch)
tree1f6603ff9f3eede365e6963b3ac66b5edbd232fb /.config/eww/scripts/battery
parent8f7cbf4ad87d63fe82173645ecb590ebb0f12354 (diff)
eww: Add an eww configuration
Diffstat (limited to '.config/eww/scripts/battery')
-rwxr-xr-x.config/eww/scripts/battery37
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