3 ms·
tmux supports multiple sessions and switching between those. sessions behave independently like your screen windows. you can of course have multiple windows in
by em-bee 6y ago
tmux supports multiple sessions and switching between those. sessions behave independently like your screen windows. you can of course have multiple windows in each session, which then behave the tmux way.
you can also have the same window show up in multipe sessions and use that to emulate screen behavior. (i saw a script to help with that some time ago) for me, multiple sessions alone provide enough flexibility.
- wnoise 6y agoIt probably technically does, in a horrifying Turing-tarpit way. I actually did try to get the behavior I wanted out of nested tmux invocations and a hairy mess of scripts. There was no 'next-session' command (though now it looks like 'switch-client -l/-n/-p' would work. Hmm.) I couldn't get it to work right, only a half-done approximation, and it involved way too many tmux interpositions. Screen: client -> per client view of P panes -> P of entire pool of T terminals in session. Tmux: client -> 1 of S sessions -> 1 of W windows -> P panes To get splitting at the top level I need one top-level tmux client and its associated top-level session managed by one server. It can actually be locked to one window for what I care about. In each of its panes, I need to run another tmux client so as to be able to actually change what final pty each pane will display. And each of these need to be separate sessions, so that I can display separate things in each of them. Each of these separate sessions will generally only have one window, with its implicit single pane. I should, of course, run all of these inner tmux sessions as a separate server from the top one. Now I just have to make restricted keybindings for both the top and inner clients, and make make sure that any binding for the inner clients are replicated as "self-insert" in the top-level client. And remember that there are multiple places I can direct the command-lines (so need two bindings). This results in the top level server having: client -> session -> 1 window -> P Panes -> P clients And the bottom server having: P clients -> T sessions -> T windows -> T panes And this doesn't yet let you have multiple top-level clients attached the way screen does. I'm sure I could eventually sand off all the sharp edges where it doesn't do what I want and make this work. Or I could just use screen.
- em-bee 6y agowell if you want an exact emulation of screen behaviour, sure, that may be difficult. but i think you are making this a bit to complicated. if what matters is that different clients can look at different windows, then using multiple sessions with one window each will get you exactly that. you may of course need to get used to tmux way of switching sessions (which is not different than tmux way of switching windows). however, i just checked, there is a command to switch to the next session, and you can bind that to a key. add another keybinding to create a new session, and that should get you to about 90% of your expected behaviour without nesting tmux.
- wnoise 6y agoThat last 10% matters. I absolutely need split windows, and being able to switch what is in the sub-panes easily. That's what require nesting. The fact that it also doesn't have my preferred behavior for multiple clients connecting is just a minor nit-pick at that point. And I did say that the misnamed 'switch-client' would likely work. Tmux has some very nice features: a nice commmand language, xterm-style mouse support, including both event binding and sending to client (pass through only), well thought out client-server separation, the ability for other programs to fairly easily drive it, visual identification of panes, menu-popups, and the default status-line is nicer. All of that is merely nice to have, not actually needed though. It fundamentally doesn't have a model that works well for me. I wish it did, or that screen gains such things.
- monsieurbanana 6y ago> That last 10% matters. I absolutely need split windows, and being able to switch what is in the sub-panes easily. That's what require nesting. That could be solved by not relying on tmux for splitting, but on a terminal that has that feature, one ssh+tmux connection by panel. In any case, it seems that you have put a lot of thinking about this, and probably already considered this solution. I've been in the situation of trying to make my workflow perfectly fit in my new software/os/laptop/etc and not being able to make it work 100%. It's... sometimes exhausting. Nowadays I take another approach: make it fit well enough.