#!/usr/bin/env zsh
remaining=$(acpi --battery | cut -d':' -f2 | cut -d',' -f2 | sed 's/[^0-9]//g')
state=$(acpi --battery | cut -d':' -f2 | cut -d',' -f1)
if [[ -z "$remaining" ]]; then
exit
fi
fa_lightning="\uf0e7"
fa_plug="\uf1e6"
fa_battery="\uf240"
fa_question="\uf128"
if [[ $(echo "$state" | grep "Discharging") ]]; then
echo "$fa_battery $remaining%"
elif [[ $(echo "$state" | grep "Full") ]]; then
echo "$fa_plug"
elif [[ $(echo "$state" | grep "Unknown") ]]; then
echo "$fa_question"
else
echo "$fa_lightning $remaining%"
fi