9

Is it possible to make one or more tmux panes "sticky"? I.e. these panes will appear in all windows which are currently available in my tmux session?

5

This comes up on the mailing list every once in a while.

No, it is not possible to have a pane in more than one window.

The internal design of tmux allows for windows to be multiple sessions, but a pane can only belong to a single window.

3

Like Chris says, there's no built-in functionality to allow the marking of a pane as sticky, and this sort of makes sense, because it's not at all immediately apparent how to handle the re-structuring of all the panes on all the other windows when you toggle the "stickiness" of some particular pane on the current window. It would generally be bad user experience to be messing with layout in a way that isn't even visible to the user.

You may find useful a bind like this:

bind -n M-k move-pane -t ':+'
bind -n M-j move-pane -t ':-'

This would be friendly for a Vim user used to J and K for moving left and right. With this bind, tmux will step in and swallow Alt+K and Alt+J to move your active pane to the right and left windows, respectively.

It will yank the current window you're in and stuff it into the adjacent tmux window. You can even probably specify which index to insert the pane into the layout of the target window. See the manpage for the other options that can be given to move-pane.

This way, of course there is still a layout change (one in the source window which is implicit and restricted to one pane, and one in the target window, also restricted to one pane and which is directly observed) but it's much more "controlled", and so long as you keep the focus on the pane intended to be "sticky", achieves your goal, more or less.

I still find this unsatisfactory because of the necessity of focusing the pane intended to be "sticky", and that makes it difficult to quickly issue this command if you want to have a sticky pane that is always visible but you never really actually have it focused.

There is the possibility to come up with slightly more elaborate tmux scripting that uses special names for the pane you intend to be sticky and manually arranges stuff for you. This sounds like a pain in the ass, though.

One last option to entertain is to use nested tmux: Put your sticky pane in parent tmux, and have the other pane contain a tmux that hosts the rest of your terminals. This way you can switch around in your child tmux freely. The problem with this is that you'll need to come up with something workable because by default you will need to hit the prefix key twice to do the same tasks. Very annoying as well. I have binds that intelligently "tunnel" through any nested tmuxes, but the logic of these inefficient message passing schemes quickly becomes difficult to manage. And a limitation with this is that the "sticky pane" here has to span the whole height or width, it can't be a corner.

In conclusion, I would say that this is one feature that tmux should implement for us because it is nearly impossible to do right with scripting, however I do not know how it could actually be done in a non-confusing way (see my first sentence).

  • 2
    For what it's worth, I think rather than sticky being allowed, because it is indeed hard to define what to do with other windows, there should be a clone-pane, which those that really want stickyness could exploit to achieve same result. And frankly it's the clone-pane that I was looking for that lead me here, too. That would be good feature. – Tommi Kyntola Nov 12 '14 at 19:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.