#!/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