#!/bin/sh level=$(cat /sys/class/power_supply/BAT0/capacity) level1=$(echo $level | sed s/.$//) level2="${level: -1}" stats=$(cat /sys/class/power_supply/BAT0/status) icon="󰁹" dicon=(󰁺 󰁻 󰁼 󰁽 󰁾 󰁿 󰂀 󰂁 ) if [ $stats == "Charging" ]; then icon="󰂄" else case $level1 in 9) if (( $level2 < 5 )); then icon="󰂂" fi;; "") if (( $level < 5 )); then icon="󰂃" else icon="󰂎" fi;; *) icon=${dicon[(($level1 - 1))]};; esac fi color="^c#F75341^" if [ $level -ge 20 ]; then color="^c#FED06E^" fi if [ $level -ge 50 ]; then color="^c#98DC37^" fi echo "${color}${icon} ${level}%"