From 478e49773b61d2634ffcca01ddf8b4ee3b7828a7 Mon Sep 17 00:00:00 2001 From: Austin Beam Date: Sat, 3 May 2014 17:57:13 -0500 Subject: [PATCH] tmux: Check version for prefix active colorization Prefix active colorization feature introduced by pull request #863 causes undesired behavior on older versions of tmux. Add version checking and revert to old powerline configuration if the tmux version is less than v1.8. tmux v1.8 was the first version to support the client_prefix format variable. --- powerline/bindings/tmux/powerline.conf | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/powerline/bindings/tmux/powerline.conf b/powerline/bindings/tmux/powerline.conf index ea33c866..16204739 100644 --- a/powerline/bindings/tmux/powerline.conf +++ b/powerline/bindings/tmux/powerline.conf @@ -7,7 +7,10 @@ set -g status-interval 2 set -g status-fg colour231 set -g status-bg colour234 set -g status-left-length 20 -set -g status-left '#{?client_prefix,#[fg=colour254]#[bg=colour31]#[bold],#[fg=colour16]#[bg=colour254]#[bold]} #S #{?client_prefix,#[fg=colour31]#[bg=colour234]#[nobold],#[fg=colour254]#[bg=colour234]#[nobold]}#(eval $POWERLINE_COMMAND tmux left)' +# Version check for 'client_prefix' format functionality +if-shell '[ $TMUX_VERSION_MAJOR -gt 1 -o \( $TMUX_VERSION_MAJOR -eq 1 -a $TMUX_VERSION_MINOR -ge 8 \) ]' \ + "set -g status-left '#{?client_prefix,#[fg=colour254]#[bg=colour31]#[bold],#[fg=colour16]#[bg=colour254]#[bold]} #S #{?client_prefix,#[fg=colour31]#[bg=colour234]#[nobold],#[fg=colour254]#[bg=colour234]#[nobold]}#(eval $POWERLINE_COMMAND tmux left)'" \ + "set -g status-left '#[fg=colour16,bg=colour254,bold] #S #[fg=colour254,bg=colour234,nobold]#(eval $POWERLINE_COMMAND tmux left)'" set -g status-right '#(eval $POWERLINE_COMMAND tmux right -R pane_id=`tmux display -p "#D"`)' set -g status-right-length 150 set -g window-status-format "#[fg=colour244,bg=colour234]#I #[fg=colour240] #[default]#W "