X-Git-Url: http://git.grml.org/?a=blobdiff_plain;f=etc%2Fzsh%2Fzshrc;h=a19c9acaaf54f343698daa52473e681b6738dcc3;hb=f95ed49fb1c35f205050dd9b509067bdcde98fb2;hp=bb0c784b280146da10411123818778652e0152c8;hpb=ad16216570b28354f433db120cc71f4c21d42092;p=grml-etc-core.git diff --git a/etc/zsh/zshrc b/etc/zsh/zshrc index bb0c784..a19c9ac 100644 --- a/etc/zsh/zshrc +++ b/etc/zsh/zshrc @@ -1697,10 +1697,10 @@ fi batteryopenbsd(){ GRML_BATTERY_LEVEL='' -local batfull batwarn batnow num +local bat batfull batwarn batnow num for num in 0 1 ; do bat=$(sysctl -n hw.sensors.acpibat${num}) - if [[ ! -z $bat ]]; then + if [[ -n $bat ]]; then batfull=${"$(sysctl -n hw.sensors.acpibat${num}.amphour0)"%% *} batwarn=${"$(sysctl -n hw.sensors.acpibat${num}.amphour1)"%% *} batnow=${"$(sysctl -n hw.sensors.acpibat${num}.amphour3)"%% *} @@ -1755,22 +1755,24 @@ batterydarwin(){ GRML_BATTERY_LEVEL='' local -a table table=( ${$(pmset -g ps)[(w)7,8]%%(\%|);} ) -case $table[2] in - charging) - GRML_BATTERY_LEVEL+=" ^" - ;; - discharging) - if (( $table[1] < 20 )) ; then - GRML_BATTERY_LEVEL+=" !v" - else - GRML_BATTERY_LEVEL+=" v" - fi - ;; - *) - GRML_BATTERY_LEVEL+=" =" - ;; -esac -GRML_BATTERY_LEVEL+="$table[1]%%" +if [[ -n $table[2] ]] ; then + case $table[2] in + charging) + GRML_BATTERY_LEVEL+=" ^" + ;; + discharging) + if (( $table[1] < 20 )) ; then + GRML_BATTERY_LEVEL+=" !v" + else + GRML_BATTERY_LEVEL+=" v" + fi + ;; + *) + GRML_BATTERY_LEVEL+=" =" + ;; + esac + GRML_BATTERY_LEVEL+="$table[1]%%" +fi } # set variable debian_chroot if running in a chroot with /etc/debian_chroot @@ -2409,8 +2411,6 @@ hash -d linux=/lib/modules/$(command uname -r)/build/ hash -d log=/var/log hash -d slog=/var/log/syslog hash -d src=/usr/src -hash -d templ=/usr/share/doc/grml-templates -hash -d tt=/usr/share/doc/texttools-doc hash -d www=/var/www #d# end