updated/renamed battery plugin

This commit is contained in:
Benjamin Martinez 2011-04-08 21:08:50 -07:00
commit 38c167b33d

View file

@ -8,10 +8,10 @@ elif [ -e /proc/acpi/battery/BAT1/ ]
then then
battpath="/proc/acpi/battery/BAT1" battpath="/proc/acpi/battery/BAT1"
else else
echo "No battery found. Make sure that you have acpi support in your kernel" echo "--"
echo "and that the computer actually is a laptop :)"
exit 1 exit 1
fi fi
batt_prompt_perc(){ batt_prompt_perc(){
fullcap=`grep "^last full capacity" $battpath/info | awk '{ print $4 }'` fullcap=`grep "^last full capacity" $battpath/info | awk '{ print $4 }'`
remcap=`grep "^remaining capacity" $battpath/state | awk '{ print $3 }'` remcap=`grep "^remaining capacity" $battpath/state | awk '{ print $3 }'`
@ -24,36 +24,35 @@ if [ "$charge" -gt "99" ]
charge=100 charge=100
fi fi
color="red" color="$ZSH_THEME_BATPERC_PROMPT_CLRLESS25PRC"
if [ $charge -gt "80" ] if [ $charge -gt "80" ]
then then
color="cyan" color="$ZSH_THEME_BATPERC_PROMPT_CLRMORE80PRC"
elif [ $charge -gt 60 ] elif [ $charge -gt 40 ]
then then
color="green" color="$ZSH_THEME_BATPERC_PROMPT_CLR40TO80PRC"
elif [ $charge -gt 25 ] elif [ $charge -gt 25 ]
then then
color="yellow" color="$ZSH_THEME_BATPERC_PROMPT_CLR25TO40PRC"
fi fi
echo -e "%F{$color}$charge%f" echo -e "$ZSH_THEME_BATPERC_PROMPT_PREFIX%F{$color}$charge%f$ZSH_THEME_BATPERC_PROMPT_SUFFIX"
} }
bat_prompt_acstt(){ bat_prompt_acstt(){
batstate=`grep "^charging state" $battpath/state | awk '{ print $3 }'` batstate=`grep "^charging state" $battpath/state | awk '{ print $3 }'`
STUATUS=""
case "${batstate}" in case "${batstate}" in
'charged') 'charged')
clr="green" STATUS="$ZSH_THEME_ACBAT_PROMPT_CHARGED"
btst="°"
;; ;;
'charging') 'charging')
clr="blue" STATUS="$ZSH_THEME_ACBAT_PROMPT_CHARGING"
btst="+"
;; ;;
'discharging') 'discharging')
clr="yellow" STATUS="$ZSH_THEME_ACBAT_PROMPT_DISCHARGING"
btst="-"
;; ;;
esac esac
echo -e "%F{$clr}$btst%f"
echo -e "$STATUS"
} }