Last Updated: February 25, 2016
·
3.935K
· dmedvinsky

"Sticky" window in tmux

Say you want some window to be available in several sessions. For example I wanted this to have my mutt window available in different sessions.

Of course you can just create a window with a separately running mutt in each session, but while working with mutt it might not suit something else. Also, that isn't a Jedi way anyway.

So, here's the trick. First you create a new session, just as usual:

tmux new-session -s mail

Name it whatever you want, just something reasonable. You can detach from it whenever you want.

Then you attach to the session you currently want to work on:

tmux attach -t my-project

Now, in this session, execute

tmux link-window -s mail:1 -t 0

This will link window 0 in the current session with the window 1 in the session mail.

To unlink, just use unlink-window command.

You can bind those commands to some keys if you want:

bind + link-window -s coms:mutt -t 0
bind - unlink-window -t mutt

For further info consult man tmux of course.

If anyone knows a simpler way to achieve this, please leave a comment.