#! /bin/sh

source ~/.config.env

ramp10=
ramp20=
ramp30=
ramp40=
ramp50=
ramp60=
ramp70=
ramp80=
ramp90=
ramp100=
ac=ﮣ
if [ "$NO_BAT" = true ] ; then
    echo "^c#ebcb8b^$ac^d^"
else
    export bat=$(cat /sys/class/power_supply/BAT0/capacity)
    export status=$(cat /sys/class/power_supply/BAT0/status)
    export plugged=$(cat /sys/class/power_supply/AC/online)
    if [[ $plugged == "1" ]]; then
        echo "^c#ebcb8b^$ac^d^"
    elif [[ $bat -lt 10 ]]; then
        echo "^c#ebcb8b^$ramp10^d^ $bat% "
    elif [[ $bat -lt 20 ]]; then
        echo "^c#ebcb8b^$ramp20^d^ $bat% "
    elif [[ $bat -lt "30" ]]; then
        echo "^c#ebcb8b^$ramp30^d^ $bat% "
    elif [[ $bat -lt "40" ]]; then
        echo "^c#ebcb8b^$ramp40^d^ $bat% "
    elif [[ $bat -lt "50" ]]; then
        echo "^c#ebcb8b^$ramp50^d^ $bat% "
    elif [[ $bat -lt "60" ]]; then
        echo "^c#ebcb8b^$ramp60^d^ $bat% "
    elif [[ $bat -lt "70" ]]; then
        echo "^c#ebcb8b^$ramp70^d^ $bat% "
    elif [[ $bat -lt "80" ]]; then
        echo "^c#ebcb8b^$ramp80^d^ $bat% "
    elif [[ $bat -lt "90" ]]; then
        echo "^c#ebcb8b^$ramp90^d^ $bat% "
    elif [[ $bat -le "100" ]]; then
        echo "^c#ebcb8b^$ramp100^d^ $bat% "
    fi
fi
