1
0
Fork 0
mirror of synced 2024-12-13 02:45:46 -05:00

fixed #{battery_bar} and #{battery_vbar} when not using heat or gradient palettes

fixes #35
This commit is contained in:
Gregory Pakosz 2016-10-31 18:32:17 +01:00
parent b422155422
commit 689f2f0f2c

View file

@ -337,14 +337,16 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration'
# battery_empty_fg=$2 # battery_empty_fg=$2
# battery_bg=$3 # 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" ] && \ # [ x"$battery_bg" != x"none" ] && \
# battery_bar="#[bg=$battery_bg]" # battery_bar="#[bg=$battery_bg]"
# #shellcheck disable=SC2046
# [ "$full" -gt 0 ] && \ # [ "$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)) # empty=$((battery_bar_length - full))
# #shellcheck disable=SC2046
# [ "$empty" -gt 0 ] && \ # [ "$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]" # battery_bar="$battery_bar#[fg=$battery_empty_fg]"
# fi # fi
# #
@ -352,7 +354,6 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration'
# # shellcheck disable=SC2086 # # shellcheck disable=SC2086
# { set -f; IFS=,; set -- $battery_vbar_palette; unset IFS; set +f; } # { set -f; IFS=,; set -- $battery_vbar_palette; unset IFS; set +f; }
# palette_style=$1 # palette_style=$1
# battery_vbar_bg=${2:-none}
# [ x"$palette_style" = x"gradient" ] && \ # [ x"$palette_style" = x"gradient" ] && \
# palette="196 202 208 214 220 226 190 154 118 82 46" # palette="196 202 208 214 220 226 190 154 118 82 46"
# [ x"$palette_style" = x"heat" ] && \ # [ x"$palette_style" = x"heat" ] && \
@ -374,7 +375,7 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration'
# eval set -- "▁ ▂ ▃ ▄ ▅ ▆ ▇ █" # eval set -- "▁ ▂ ▃ ▄ ▅ ▆ ▇ █"
# # shellcheck disable=SC2046 # # shellcheck disable=SC2046
# eval $(awk "BEGIN { printf \"battery_vbar_symbol=$%d\", ($charge) * ($# - 1) + 1 }") # 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 }")" # battery_percentage="$(awk "BEGIN { printf \"%.0f%%\", ($charge) * 100 }")"
# #
@ -389,10 +390,12 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration'
# ssh_only=$2 # ssh_only=$2
# # shellcheck disable=SC2039 # # shellcheck disable=SC2039
# if [ x"$OSTYPE" = x"cygwin" ]; then # 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 //') # [ -n "$pid" ] && ssh_parameters=$(tr '\0' ' ' < "/proc/$pid/cmdline" | sed 's/^ssh //')
# else # 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 # fi
# if [ -n "$ssh_parameters" ]; then # if [ -n "$ssh_parameters" ]; then
# # shellcheck disable=SC2086 # # shellcheck disable=SC2086
@ -428,10 +431,10 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration'
# ssh_only=$2 # ssh_only=$2
# # shellcheck disable=SC2039 # # shellcheck disable=SC2039
# if [ x"$OSTYPE" = x"cygwin" ]; then # 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 //') # [ -n "$pid" ] && ssh_parameters=$(tr '\0' ' ' < "/proc/$pid/cmdline" | sed 's/^ssh //')
# else # 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 # fi
# if [ -n "$ssh_parameters" ]; then # if [ -n "$ssh_parameters" ]; then
# # shellcheck disable=SC2086 # # shellcheck disable=SC2086