From 689f2f0f2cd733f95212d17620c8b7b916e0d650 Mon Sep 17 00:00:00 2001 From: Gregory Pakosz Date: Mon, 31 Oct 2016 18:32:17 +0100 Subject: [PATCH] fixed #{battery_bar} and #{battery_vbar} when not using heat or gradient palettes fixes #35 --- .tmux.conf | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/.tmux.conf b/.tmux.conf index 2e96dcf..a552bf4 100644 --- a/.tmux.conf +++ b/.tmux.conf @@ -337,14 +337,16 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration' # battery_empty_fg=$2 # battery_bg=$3 # -# full=$(awk "BEGIN { print \"%d\" ($charge) * $battery_bar_length }") +# full=$(awk "BEGIN { printf \"%.0f\", ($charge) * $battery_bar_length }") # [ x"$battery_bg" != x"none" ] && \ # battery_bar="#[bg=$battery_bg]" +# #shellcheck disable=SC2046 # [ "$full" -gt 0 ] && \ -# battery_bar="$battery_bar#[fg=$battery_full_fg]$(printf "%0.s$battery_bar_symbol_full" "$(seq 1 "$full")")" +# battery_bar="$battery_bar#[fg=$battery_full_fg]$(printf "%0.s$battery_bar_symbol_full" $(seq 1 "$full"))" # empty=$((battery_bar_length - full)) +# #shellcheck disable=SC2046 # [ "$empty" -gt 0 ] && \ -# battery_bar="$battery_bar#[fg=$battery_empty_fg]$(printf "%0.s$battery_bar_symbol_empty" "$(seq 1 "$empty")")" && \ +# battery_bar="$battery_bar#[fg=$battery_empty_fg]$(printf "%0.s$battery_bar_symbol_empty" $(seq 1 "$empty"))" && \ # battery_bar="$battery_bar#[fg=$battery_empty_fg]" # fi # @@ -352,7 +354,6 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration' # # shellcheck disable=SC2086 # { set -f; IFS=,; set -- $battery_vbar_palette; unset IFS; set +f; } # palette_style=$1 -# battery_vbar_bg=${2:-none} # [ x"$palette_style" = x"gradient" ] && \ # palette="196 202 208 214 220 226 190 154 118 82 46" # [ x"$palette_style" = x"heat" ] && \ @@ -374,7 +375,7 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration' # eval set -- "▁ ▂ ▃ ▄ ▅ ▆ ▇ █" # # shellcheck disable=SC2046 # eval $(awk "BEGIN { printf \"battery_vbar_symbol=$%d\", ($charge) * ($# - 1) + 1 }") -# battery_vbar="#[fg=${battery_vbar_fg?}]#[bg=${battery_vbar_bg?}]${battery_vbar_symbol?}" +# battery_vbar="#[fg=${battery_vbar_fg?}]${battery_vbar_symbol?}" # # battery_percentage="$(awk "BEGIN { printf \"%.0f%%\", ($charge) * 100 }")" # @@ -389,10 +390,12 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration' # ssh_only=$2 # # shellcheck disable=SC2039 # if [ x"$OSTYPE" = x"cygwin" ]; then -# pid=$(ps -a | awk -v tty="${tty##/dev/}" '$5 == tty && /ssh/ && !/autossh/ && !/-W/ { print $1 }') +# pid=$(ps -a | awk -v tty="${tty##/dev/}" '$5 == tty && /ssh/ && && !/vagrant ssh/ && !/autossh/ && !/-W/ { print $1 }') # [ -n "$pid" ] && ssh_parameters=$(tr '\0' ' ' < "/proc/$pid/cmdline" | sed 's/^ssh //') # else -# ssh_parameters=$(ps -t "$tty" -o command= | awk '/ssh/ && !/autossh/ && !/-W/ { $1=""; print $0; exit }') +# set -x +# ssh_parameters=$(ps -t "$tty" -o command= | awk '/ssh/ && !/vagrant ssh/ && !/autossh/ && !/-W/ { $1=""; print $0; exit }') +# set +x # fi # if [ -n "$ssh_parameters" ]; then # # shellcheck disable=SC2086 @@ -428,10 +431,10 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration' # ssh_only=$2 # # shellcheck disable=SC2039 # if [ x"$OSTYPE" = x"cygwin" ]; then -# pid=$(ps -a | awk -v tty="${tty##/dev/}" '$5 == tty && /ssh/ && !/autossh/ && !/-W/ { print $1 }') +# pid=$(ps -a | awk -v tty="${tty##/dev/}" '$5 == tty && /ssh/ && !/vagrant ssh/ && !/autossh/ && !/-W/ { print $1 }') # [ -n "$pid" ] && ssh_parameters=$(tr '\0' ' ' < "/proc/$pid/cmdline" | sed 's/^ssh //') # else -# ssh_parameters=$(ps -t "$tty" -o command= | awk '/ssh/ && !/autossh/ && !/-W/ { $1=""; print $0; exit }') +# ssh_parameters=$(ps -t "$tty" -o command= | awk '/ssh/ && !/vagrant ssh/ && !/autossh/ && !/-W/ { $1=""; print $0; exit }') # fi # if [ -n "$ssh_parameters" ]; then # # shellcheck disable=SC2086