all repos — dotfiles @ 8d840f5a83a290c1082baf019f51b0da6131cc28

linux dotfiles

i3blocks/battery

#!/bin/sh
percent=$(acpi | cut -d ' ' -f4 | tail -1 |  tr -d ',')
state=$(acpi | cut -d ' ' -f3 | tail -1 | tr -d ',')

case $state in
    Charging)
        symbol="<span font='Font Awesome 5 Free 9'>\uf0e7 </span>"
        ;;
    *)
        #symbol="<span font='Icons 11'>\uf213</span>"
        #symbol="<span font='Material Design Icons'>\uf079</span>"
        [ $percent -le 30 ] && notify-send -u critical "Battery Low" -i battery-low
        ;;
esac


echo -e "$symbol$percent"

awk -v percent=$percent '
    BEGIN {
        if (percent <= 30) {
            print "#FF0000";
            exit 33;
        }
    }
'