#!/bin/sh
percent=$(acpi | cut -d ' ' -f4 | tail -1 | tr -d ',')
state=$(acpi | cut -d ' ' -f3 | tail -1 | tr -d ',')
percent_no=$(echo -n $percent | tr -d '%')
case $state in
Charging)
symbol="\uf0e7 "
;;
*)
#symbol="\uf213"
#symbol="\uf079"
[ $percent_no -le 30 ] && notify-send -i battery-low -u critical "Battery Low"
;;
esac
echo -e "$symbol$percent"
awk -v percent=$percent_no '
BEGIN {
if (percent <= 30) {
print "#FF0000";
exit 33;
}
}
'