X-Git-Url: https://git.grml.org/?a=blobdiff_plain;f=etc%2Fzsh%2Fzshrc;h=7b04de89a2fb80fa783d43eb99b2aab6fb201bed;hb=cedfc98d894d4c53123046ef4c1ca65135f9f9a4;hp=a7b70d278e13280b55bfd38b1ba9bfbd868e2266;hpb=b2556e790bfa859893f7ef436b84694f54681841;p=grml-etc-core.git diff --git a/etc/zsh/zshrc b/etc/zsh/zshrc index a7b70d2..7b04de8 100644 --- a/etc/zsh/zshrc +++ b/etc/zsh/zshrc @@ -1761,7 +1761,13 @@ local batteries bat capacity batteries=( /sys/class/power_supply/BAT*(N) ) if (( $#batteries > 0 )) ; then for bat in $batteries ; do - capacity=$(< $bat/capacity) + if [[ -e $bat/capacity ]]; then + capacity=$(< $bat/capacity) + else + typeset -F energy_full=$(< $bat/energy_full) + typeset -F energy_now=$(< $bat/energy_now) + typeset -i capacity=$(( 100 * $energy_now / $energy_full)) + fi case $(< $bat/status) in Charging) GRML_BATTERY_LEVEL+=" ^" @@ -3127,10 +3133,14 @@ for var in BLUE RED GREEN CYAN YELLOW MAGENTA WHITE ; unset $var builtin unset -v var # "persistent history" -# just write important commands you always need to ~/.important_commands +# just write important commands you always need to $GRML_IMPORTANT_COMMANDS +# defaults for backward compatibility to ~/.important_commands if [[ -r ~/.important_commands ]] ; then - fc -R ~/.important_commands + GRML_IMPORTANT_COMMANDS=~/.important_commands +else + GRML_IMPORTANT_COMMANDS=${GRML_IMPORTANT_COMMANDS:-${ZDOTDIR:-${HOME}}/.important_commands} fi +[[ -r ${GRML_IMPORTANT_COMMANDS} ]] && builtin fc -R ${GRML_IMPORTANT_COMMANDS} # load the lookup subsystem if it's available on the system zrcautoload lookupinit && lookupinit