mirror of
1
0
Fork 0

pimped the battery indicator with a heat palette

This commit is contained in:
Gregory Pakosz 2015-03-28 10:17:43 +01:00
parent 417fdb27f5
commit e5117980de
4 changed files with 56 additions and 21 deletions

View File

@ -244,13 +244,16 @@ run 'for name in $(printenv | grep -Eo ^tmux_conf_[^=]+); do tmux setenv -gu $na
# window_status_last_attr=default
# tmux setw -g window-status-last-style $window_status_last_attr,fg=$window_status_last_fg
#
# time_date_fg=colour245 # light gray
# time_date_bg=colour232 # dark gray
# whoami_fg=colour254 # white
# whoami_bg=colour160 # red
# host_fg=colour16 # black
# host_bg=colour254 # white
# status_right="${tmux_conf_battery:-#(cut -c3- ~/.tmux.conf | sh -s battery ${tmux_conf_battery_symbol:-block} ${tmux_conf_battery_symbol_count:-auto})} #[fg=$time_date_fg,nobold]$right_separator %R $right_separator %d %b #[fg=$whoami_bg,bg=$time_date_bg,nobold]$right_separator_black#[fg=$whoami_fg,bg=$whoami_bg,nobold] #(whoami) $right_separator_black#[fg=$host_fg,bg=$host_bg,bold] #h "
# battery_full_fg=colour160 # red
# battery_empty_fg=colour254 # white
# battery_bg=colour160 # black
# time_date_fg=colour245 # light gray
# time_date_bg=colour232 # dark gray
# whoami_fg=colour254 # white
# whoami_bg=colour160 # red
# host_fg=colour16 # black
# host_bg=colour254 # white
# status_right="${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})} #[fg=$time_date_fg,nobold]$right_separator %R $right_separator %d %b #[fg=$whoami_bg,bg=$time_date_bg,nobold]$right_separator_black#[fg=$whoami_fg,bg=$whoami_bg,nobold] #(whoami) $right_separator_black#[fg=$host_fg,bg=$host_bg,bold] #h "
# tmux set -g status-right-length 64 \; set -g status-right "$status_right"
#
# # clock
@ -314,6 +317,7 @@ run 'for name in $(printenv | grep -Eo ^tmux_conf_[^=]+); do tmux setenv -gu $na
# battery() {
# battery_symbol=$1
# battery_symbol_count=$2
# battery_palette=$3
# if [ $battery_symbol_count = auto ]; then
# columns=$(tmux display -p '#{client_width}' || echo 80)
# if [ $columns -ge 80 ]; then
@ -322,11 +326,6 @@ run 'for name in $(printenv | grep -Eo ^tmux_conf_[^=]+); do tmux setenv -gu $na
# battery_symbol_count=5
# fi
# fi
# battery_full_fg=colour160
# battery_full_bg=colour16
# battery_empty_fg=colour254
# battery_empty_bg=colour16
#
# battery_symbol_heart_full=♥
# battery_symbol_heart_empty=♥
# battery_symbol_block_full=◼
@ -352,14 +351,42 @@ run 'for name in $(printenv | grep -Eo ^tmux_conf_[^=]+); do tmux setenv -gu $na
# charge="$(cat $batnow) / $(cat $batfull)" || return
# fi
#
# full=$(printf %.0f $(echo "$charge * $battery_symbol_count" | bc -l))
# [ $full -gt 0 ] && \
# printf '#[fg=%s,bg=%s]' $battery_full_fg $battery_full_bg && \
# printf "%0.s$battery_symbol_full" $(seq 1 $full)
# empty=$(($battery_symbol_count - $full))
# [ $empty -gt 0 ] && \
# printf '#[fg=%s,bg=%s]' $battery_empty_fg $battery_empty_bg && \
# printf "%0.s$battery_symbol_empty" $(seq 1 $empty)
# if echo $battery_palette | grep -q -E '^(colour[0-9]{1,3},?){3}$'; then
# battery_full_fg=$(echo $battery_palette | cut -d, -f1)
# battery_empty_fg=$(echo $battery_palette | cut -d, -f2)
# battery_bg=$(echo $battery_palette | cut -d, -f3)
#
# full=$(printf %.0f $(echo "$charge * $battery_symbol_count" | bc -l))
# [ $full -gt 0 ] && \
# printf '#[fg=%s,bg=%s]' $battery_full_fg $battery_bg && \
# printf "%0.s$battery_symbol_full" $(seq 1 $full)
# empty=$(($battery_symbol_count - $full))
# [ $empty -gt 0 ] && \
# printf '#[fg=%s,bg=%s]' $battery_empty_fg $battery_bg && \
# printf "%0.s$battery_symbol_empty" $(seq 1 $empty)
# elif echo $battery_palette | grep -q -E '^heat(,colour[0-9]{1,3})?$'; then
# battery_bg=$(echo $battery_palette | cut -s -d, -f2)
# battery_bg=${battery_bg:-colour16}
# heat="233 234 235 237 239 241 243 245 247 144 143 142 184 214 208 202 196"
# heat_count=$(echo $(echo $heat | wc -w))
#
# eval set -- "$heat"
# heat=$(eval echo $(eval echo $(printf "\\$\{\$(expr %s \* $heat_count / $battery_symbol_count)\} " $(seq 1 $battery_symbol_count))))
#
# full=$(printf %.0f $(echo "$charge * $battery_symbol_count" | bc -l))
# printf '#[bg=%s]' $battery_bg
# [ $full -gt 0 ] && \
# printf "#[fg=colour%s]$battery_symbol_full" $(echo $heat | cut -d' ' -f1-$full)
# empty=$(($battery_symbol_count - $full))
# if [ x"$battery_symbol" = x"heart" ]; then
# [ $empty -gt 0 ] && \
# printf '#[fg=%s]' $battery_bg && \
# printf "%0.s$battery_symbol_empty" $(seq 1 $empty)
# else
# [ $empty -gt 0 ] && \
# printf "#[fg=colour%s]$battery_symbol_empty" $(echo $heat | cut -d' ' -f$full-$(expr $full + $empty))
# fi
# fi
# }
#
# apply_configurable_bindings() {

View File

@ -5,6 +5,9 @@
#tmux_conf_battery_symbol=heart
#tmux_conf_battery_symbol_count=5
# use the heat palette for the battery status
#tmux_conf_battery_palette=heat
# or alternatively use an external tool, e.g. https://github.com/Goles/Battery
#tmux_conf_battery='#(battery -t) '

View File

@ -3,7 +3,7 @@
Self-contained, opinionated `.tmux.conf` configuration file.
![Screenshot](screenshot.png)
![Screenshot](https://cloud.githubusercontent.com/assets/553208/6979291/36999f48-d9e2-11e4-8815-449f7372b496.png)
The `master` branch targets tmux 1.9+. You may want to use the `1.7` or `1.8`
branch.
@ -58,6 +58,11 @@ Edit your `~/.tmux.conf.local` file and uncomment the following lines:
#tmux_conf_battery_symbol=heart
#tmux_conf_battery_symbol_count=5
To use a heat palette for the battery indicator, edit your `~/.tmux.conf.local`
file and uncomment the following line:
#tmux_conf_battery_palette=heat
See `~/.tmux.conf.local` for more details.
### Configuring new windows and new panes creation

Binary file not shown.

Before

Width:  |  Height:  |  Size: 25 KiB