4 # Prepare a "battery level" gauge ready to be used in prompt.
9 local online remaining bstatus gauge gcolor
12 acpi -B -a | grep -q "on-line" && online=1
16 remaining="$(echo ${bstatus[(w)4]} | sed -r 's/(^[0-9]+)%.*/\1/')"
18 if [[ -z "$remaining" ]]; then
21 elif [[ "$remaining" -eq "100" && "$online" -eq "1" ]]; then
24 #elif [[ "$remaining" -gt "95" ]]; then
25 # export BATT_GAUGE=""
27 elif [[ "$remaining" -lt "10" ]]; then
36 for i in $(seq ${remaining[1]}); do
40 if [[ "${#gauge}" -lt "3" ]]; then
42 elif [[ "${#gauge}" -lt "6" ]]; then
51 precmd_functions+="battery_level"