From e36770b0f6008df9e065dcc6249afe8569f236e5 Mon Sep 17 00:00:00 2001 From: Krasimir Nedelchev <19822240+kaykayehnn@users.noreply.github.com> Date: Wed, 8 Jan 2020 02:40:50 +0200 Subject: [PATCH] Handle versions of tmux < 3.0 correctly --- pain_control.tmux | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/pain_control.tmux b/pain_control.tmux index 6f05cca..1fd91bd 100755 --- a/pain_control.tmux +++ b/pain_control.tmux @@ -27,8 +27,15 @@ pane_navigation_bindings() { } window_move_bindings() { - tmux bind-key -r "<" swap-window -d -t -1 - tmux bind-key -r ">" swap-window -d -t +1 + # V3.0 changed the way tmux handles focus in swap-window. -d is now required + # to keep focus on the current window. + if [ "$(tmux -V | cut -d' ' -f2)" ">" 3.0 ]; then + tmux bind-key -r "<" swap-window -d -t -1 + tmux bind-key -r ">" swap-window -d -t +1 + else + tmux bind-key -r "<" swap-window -t -1 + tmux bind-key -r ">" swap-window -t +1 + fi } pane_resizing_bindings() {