#!/bin/sh set -e cd /sys/class/power_supply/BAT1 awk ' FILENAME == "capacity" { val = $0 printf "percentage=%d%%\n", val } FILENAME == "status" { printf "icon=" if ($0 == "Charging") print "󰂄" else if (val >= 90) print "󰁹" else if (val >= 80) print "󰂂" else if (val >= 70) print "󰂁" else if (val >= 60) print "󰁿" else if (val >= 50) print "󰁾" else if (val >= 40) print "󰁽" else if (val >= 30) print "󰁼" else if (val >= 20) print "󰁻" else if (val >= 10) print "󰁺" else print "󰂎" }' capacity status \ | jo