1
0
Fork 0
mirror of synced 2024-12-21 22:31:06 -05:00

added #{battery_hbar} using U+258F - U+2588

This commit is contained in:
Gregory Pakosz 2016-10-31 21:34:21 +01:00
parent 689f2f0f2c
commit f828eafc2b
2 changed files with 46 additions and 4 deletions

View file

@ -277,6 +277,7 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration'
# show -gqv '@battery_bar_symbol_empty' \;\
# show -gqv '@battery_bar_length' \;\
# show -gqv '@battery_bar_palette' \;\
# show -gqv '@battery_hbar_palette' \;\
# show -gqv '@battery_vbar_palette' \;\
# show -gqv '@battery_status_charging' \;\
# show -gqv '@battery_status_discharging')
@ -287,9 +288,10 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration'
# battery_bar_symbol_empty=$2
# battery_bar_length=$3
# battery_bar_palette=$4
# battery_vbar_palette=$5
# battery_status_charging=$6
# battery_status_discharging=$7
# battery_hbar_palette=$5
# battery_vbar_palette=$6
# battery_status_charging=$7
# battery_status_discharging=$8
#
# if [ x"$battery_bar_length" = x"auto" ]; then
# columns=$(tmux -q display -p '#{client_width}' 2> /dev/null || echo 80)
@ -350,6 +352,33 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration'
# battery_bar="$battery_bar#[fg=$battery_empty_fg]"
# fi
#
# if echo "$battery_hbar_palette" | grep -q -E '^heat|gradient(,[#a-z0-9]{7,9})?$'; then
# # shellcheck disable=SC2086
# { set -f; IFS=,; set -- $battery_hbar_palette; unset IFS; set +f; }
# palette_style=$1
# [ x"$palette_style" = x"gradient" ] && \
# palette="196 202 208 214 220 226 190 154 118 82 46"
# [ x"$palette_style" = x"heat" ] && \
# palette="233 234 235 237 239 241 243 245 247 144 143 142 184 214 208 202 196"
#
# palette=$(echo "$palette" | awk -v n="$battery_bar_length" '{ for (i = 0; i < n; ++i) printf $(1 + (i * NF / n))" " }')
# eval set -- "$palette"
#
# full=$(awk "BEGIN { printf \"%.0f\", ($charge) * $battery_bar_length }")
# eval battery_hbar_fg="colour\${$((full == 0 ? 1 : full))}"
# elif echo "$battery_hbar_palette" | grep -q -E '^([#a-z0-9]{7,9},?){3}$'; then
# # shellcheck disable=SC2086
# { set -f; IFS=,; set -- $battery_hbar_palette; unset IFS; set +f; }
#
# # shellcheck disable=SC2046
# eval $(awk "BEGIN { printf \"battery_hbar_fg=$%d\", (($charge) - 0.001) * $# + 1 }")
# fi
#
# eval set -- "▏ ▎ ▍ ▌ ▋ ▊ ▉ █"
# # shellcheck disable=SC2046
# eval $(awk "BEGIN { printf \"battery_hbar_symbol=$%d\", ($charge) * ($# - 1) + 1 }")
# battery_hbar="#[fg=${battery_hbar_fg?}]${battery_hbar_symbol?}"
#
# if echo "$battery_vbar_palette" | grep -q -E '^heat|gradient(,[#a-z0-9]{7,9})?$'; then
# # shellcheck disable=SC2086
# { set -f; IFS=,; set -- $battery_vbar_palette; unset IFS; set +f; }
@ -381,6 +410,7 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration'
#
# tmux set -g '@battery_status' "$battery_status" \;\
# set -g '@battery_bar' "$battery_bar" \;\
# set -g '@battery_hbar' "$battery_hbar" \;\
# set -g '@battery_vbar' "$battery_vbar" \;\
# set -g '@battery_percentage' "$battery_percentage"
# }
@ -879,19 +909,22 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration'
# tmux_conf_battery_bar_symbol_empty=${tmux_conf_battery_bar_symbol_empty:-'◻'}
# tmux_conf_battery_bar_length=${tmux_conf_battery_bar_length:-'auto'}
# tmux_conf_battery_bar_palette=${tmux_conf_battery_bar_palette:-'gradient'}
# tmux_conf_battery_hbar_palette=${tmux_conf_battery_hbar_palette:-'gradient'} # red, orange, green
# tmux_conf_battery_vbar_palette=${tmux_conf_battery_vbar_palette:-'gradient'} # red, orange, green
# tmux_conf_battery_status_charging=${tmux_conf_battery_status_charging:-'⚡'} # U+26A1
# tmux_conf_battery_status_discharging=${tmux_conf_battery_status_discharging:-'🔋'} # U+1F50B
#
# case "$status_left $status_right" in
# *'#{battery_status}'*|*'#{battery_bar}'*|*'#{battery_vbar}'*|*'#{battery_percentage}'*)
# *'#{battery_status}'*|*'#{battery_bar}'*|*'#{battery_hbar}'*|*'#{battery_vbar}'*|*'#{battery_percentage}'*)
# status_left=$(echo "$status_left" | sed -E \
# -e 's/#\{(\?)?battery_bar/#\{\1@battery_bar/g' \
# -e 's/#\{(\?)?battery_hbar/#\{\1@battery_hbar/g' \
# -e 's/#\{(\?)?battery_vbar/#\{\1@battery_vbar/g' \
# -e 's/#\{(\?)?battery_status/#\{\1@battery_status/g' \
# -e 's/#\{(\?)?battery_percentage/#\{\1@battery_percentage/g')
# status_right=$(echo "$status_right" | sed -E \
# -e 's/#\{(\?)?battery_bar/#\{\1@battery_bar/g' \
# -e 's/#\{(\?)?battery_hbar/#\{\1@battery_hbar/g' \
# -e 's/#\{(\?)?battery_vbar/#\{\1@battery_vbar/g' \
# -e 's/#\{(\?)?battery_status/#\{\1@battery_status/g' \
# -e 's/#\{(\?)?battery_percentage/#\{\1@battery_percentage/g')
@ -900,6 +933,7 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration'
# set -g '@battery_bar_symbol_empty' "$tmux_conf_battery_bar_symbol_empty" \;\
# set -g '@battery_bar_length' "$tmux_conf_battery_bar_length" \;\
# set -g '@battery_bar_palette' "$tmux_conf_battery_bar_palette" \;\
# set -g '@battery_hbar_palette' "$tmux_conf_battery_hbar_palette" \;\
# set -g '@battery_vbar_palette' "$tmux_conf_battery_vbar_palette" \;\
# set -g '@battery_status_charging' "$tmux_conf_battery_status_charging" \;\
# set -g '@battery_status_discharging' "$tmux_conf_battery_status_discharging"

View file

@ -138,6 +138,7 @@ tmux_conf_theme_right_separator_sub='|'
# - separate subsections with ','
# - built-in variables are:
# - #{battery_bar}
# - #{battery_hbar}
# - #{battery_percentage}
# - #{battery_status}
# - #{battery_vbar}
@ -202,6 +203,13 @@ tmux_conf_battery_bar_length='auto'
tmux_conf_battery_bar_palette='gradient'
#tmux_conf_battery_bar_palette='#d70000,#e4e4e4,#000000' # red, white, black
# battery hbar palette, possible values are:
# - gradient (default)
# - heat
# - 'colour_low,colour_half,colour_full'
tmux_conf_battery_hbar_palette='gradient'
#tmux_conf_battery_hbar_palette='#d70000,#ff5f00,#5fff00' # red, orange, green
# battery vbar palette, possible values are:
# - gradient (default)
# - heat