The solution above works, but only after I use the keyboard shortcut that I have set to reload the configuration. At some point it stops working again, as when I find myself trying to shift a window on the statusbar again, I have to reload the configuration again.
I have only noticed this on my laptop (not other hosts that I remote into), which just happens to be the only system that I am using that uses a > v3.0 tmux. Does anybody know why it seems to be losing this setting, or have any ideas on how to troubleshoot it? On Thursday, 24 June 2021 at 08:06:32 UTC+1 eggbean wrote: > No. I have found that it was a still undocumented change made in v3.0. > > https://github.com/tmux/tmux/issues/2056 > > I have done this to get around it, as I use different versions of tmux and > the same .tmux.config: > > # Find and set tmux version > run-shell 'tmux setenv -g TMUX_VERSION $(tmux -V | \ > sed -En "s/^tmux ([0-9]+(.[0-9]+)?).*/\1/p")' > ... > # Move window on statusbar > if-shell -b '[ "$(echo "$TMUX_VERSION < 3.0" | bc)" = 1 ]' " \ > bind -n C-S-PPage swap-window -t :-1; \ > bind -n C-S-NPage swap-window -t :+1" > if-shell -b '[ "$(echo "$TMUX_VERSION >= 3.0" | bc)" = 1 ]' " \ > bind -n C-S-PPage swap-window -d -t :-1; \ > bind -n C-S-NPage swap-window -d -t :+1" > > Seems to be working well so far. > > Cheers > On Thursday, 24 June 2021 at 05:51:04 UTC+1 Scott Rochford wrote: > >> Are the the tmux versions (tmux -V) the same? >> >> Regards >> Scott >> >> On Thu, 24 Jun 2021, 10:57 eggbean, <[email protected]> wrote: >> >>> I have been using these settings for many years (around 12 years) on >>> remote SSH sessions without any problems. >>> >>> # Window navigation >>> bind -n C-PPage prev >>> bind -n C-NPage next >>> bind -n C-S-PPage swap-window -t -1 >>> bind -n C-S-NPage swap-window -t +1 >>> >>> But I have started using Linux as desktop OS relatively recently, and so >>> I have had this problem for a couple of years, but thought I would >>> eventually figure out what the problem is, but I still have not: >>> >>> PROBLEM: The second two settings, to move the windows in the statusbar >>> work fine on remote SSH sessions, but when tmux is used locally, they >>> don't. The windows get swapped as expected, but the other window becomes >>> the current one, instead of the one that was current when the swap was >>> initiated. >>> >>> Why does this happen? >>> >>> I am using Pop!_OS 20.04, which is based on Ubuntu and Alacritty as the >>> terminal emulator, although this behaviour seems to work on any terminal. >>> >>> Thanks for any help that can be provided. >>> >>> -- >>> You received this message because you are subscribed to the Google >>> Groups "tmux-users" group. >>> To unsubscribe from this group and stop receiving emails from it, send >>> an email to [email protected]. >>> To view this discussion on the web, visit >>> https://groups.google.com/d/msgid/tmux-users/41a14582-ff8e-4a78-aab1-f8f21b4ada25n%40googlegroups.com >>> >>> <https://groups.google.com/d/msgid/tmux-users/41a14582-ff8e-4a78-aab1-f8f21b4ada25n%40googlegroups.com?utm_medium=email&utm_source=footer> >>> . >>> >> -- You received this message because you are subscribed to the Google Groups "tmux-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web, visit https://groups.google.com/d/msgid/tmux-users/4d6b532b-38f8-4d14-9ce7-5ec910f07f6dn%40googlegroups.com.
