1
0
Fork 0
mirror of synced 2024-12-12 18:35:47 -05:00

added a percentage style to the battery indicator

This commit is contained in:
Gregory Pakosz 2016-01-16 18:57:30 +01:00
parent 33e0fe5468
commit de55dc6e6a
3 changed files with 27 additions and 7 deletions

View file

@ -275,7 +275,7 @@ run 'cut -c3- ~/.tmux.conf | sh -s apply_configuration'
# status_right_prefix="#{?client_prefix,#[fg=$tmux_conf_theme_prefix_fg]#[bg=$tmux_conf_theme_prefix_bg]#[bold]⌨ #[fg=$tmux_conf_theme_prefix_fg]#[bg=$tmux_conf_theme_status_bg]#[nobold],}"
# fi
# if [ x"$battery_enabled" = x"true" ] ; then
# status_right_battery="${tmux_conf_battery:-#(cut -c3- ~/.tmux.conf | sh -s battery ${tmux_conf_battery_symbol:-block} ${tmux_conf_battery_symbol_count:-auto} \"${tmux_conf_battery_palette:-colour160,colour254,colour16}\" ${tmux_conf_battery_status:-enabled})} "
# status_right_battery="${tmux_conf_battery:-#(cut -c3- ~/.tmux.conf | sh -s battery ${tmux_conf_battery_style:-bar} ${tmux_conf_battery_symbol:-block} ${tmux_conf_battery_symbol_count:-auto} \"${tmux_conf_battery_palette:-colour160,colour254,colour16}\" ${tmux_conf_battery_status:-enabled})} "
# has_battery=$(eval echo \$${status_right_battery#\#})
# if [ -n "$has_battery" ] && ([ x"$time_enabled" = x"true" ] || [ x"$date_enabled" = x"true" ]) ; then
# status_right_battery="${status_right_battery}#[fg=$tmux_conf_theme_time_date_fg,nobold]$right_separator"
@ -410,10 +410,11 @@ run 'cut -c3- ~/.tmux.conf | sh -s apply_configuration'
# return
# fi
#
# battery_symbol=$1
# battery_symbol_count=$2
# battery_palette=$3
# battery_status=$4
# battery_style=$1
# battery_symbol=$2
# battery_symbol_count=$3
# battery_palette=$4
# battery_status=$5
# if [ x"$battery_symbol_count" = x"auto" ]; then
# columns=$(tmux -q display -p '#{client_width}' 2> /dev/null || echo 80)
# if [ $columns -ge 80 ]; then
@ -437,13 +438,18 @@ run 'cut -c3- ~/.tmux.conf | sh -s apply_configuration'
# fi
# fi
#
# if [ x"$battery_style" = x"percentage" ] ; then
# printf %.0f%% $(awk "BEGIN{print $charge * 100}")
# return
# fi
#
# if echo $battery_palette | grep -q -E '^heat|gradient(,[a-z0-9]{7,9})?$'; then
# battery_style=$(echo $battery_palette | cut -d, -f1)
# palette_style=$(echo $battery_palette | cut -d, -f1)
# battery_bg=$(echo $battery_palette | cut -s -d, -f2)
# battery_bg=${battery_bg:-colour16}
# gradient="196 202 208 214 220 226 190 154 118 82 46"
# heat="233 234 235 237 239 241 243 245 247 144 143 142 184 214 208 202 196"
# eval palette=$(echo \$$battery_style)
# eval palette=$(echo \$$palette_style)
# count=$(echo $(echo $palette | wc -w))
#
# eval set -- "$palette"

View file

@ -17,6 +17,12 @@ tmux_conf_theme_prefix=disabled
tmux_conf_theme_battery=enabled
#tmux_conf_theme_battery=disabled
# style to use for the battery status, possible values are:
# - bar
# - percentage
tmux_conf_battery_style=bar
#tmux_conf_battery_style=percentage
# symbols to use for battery status, possible values are:
# - block
# - heart

View file

@ -179,6 +179,14 @@ To enable or disable the battery indicator, edit the `~/.tmux.conf.local` file
The possible values for `tmux_conf_theme_battery` are `enabled` (default) or
`disabled`.
The battery indicator can either be a charging bar or a percentage which is
controlled by the `tmux_conf_battery_style` variable:
tmux_conf_battery_style=bar
The possible values for `tmux_conf_battery_style` are `bar` (default) or
`percentage`.
You can also customize the symbol used in the battery bar as well as their
number by adjusting the `tmux_conf_battery_symbol` and
`tmux_conf_battery_symbol_count` variables.