I am using tmux -CC with "Automatically bury the tmux client session after connecting".
I connect by running my "connect command" of `ssh servername -t tmux -CC a -t myname`. That command does the following:
- ssh's to the server
- closes the current/controlling iterm window
- opens the tmux iterm window for session myname.
I would like to be able to be able to exit the tmux window and then come back to the tmux session again later by doing the connect command again.
It seems like there are three ways to close the window and all of them have a complication:
1 - detach - close via window red button
- I click on the tmux iterm window's red close button
- iterm tmux window closes
- I am returned to the controlling iterm window with tmux/ssh exited
- I then need to close that controlling window also.
- The iterm tmux dashboard shows that the tmux session still exists
I can then use the connect command above to reconnect from a different iterm window and everything works fine.
2 - kill:
- I press Cmd-W. I am them asked if I want to "kill or hide".
- I choose "kill".
- Both the tmux iterm window and control iterm window are closed. The underlying tmux and ssh are closed also I assume.
- The tmux session is killed.
- The iterm tmux dashboard no longer shows the tmux session.
When I do the connect command I get a new session. So my session has been lost (as expected with a term like kill).
3 - hide:
- I do Cmd-W and choose hide.
- The iterm tmux window is hidden and the iterm control window remains hidden also.
- The iterm tmux dashboard shows the session and its window.
When I do the connect command again in a 2nd iterm window I get a dialog box that says "This instance of iterm2 is already attached to this session.". When I click OK I see in the 2nd iterm control window that the tmux command has ended and therefore the ssh session has ended.
I would like to suggest a couple tweaks.
That when Cmd-W is pressed, there should be a "detach" option also that works the same as #1 (pressing the red button).
That the close button works the same as Cmd-W. So a user would have a choice of detach, kill, or hide.
That when a existing session myname is hidden and the user tries to attach to it (tmux -CC a -t myname). That the session is unhidden. The 2nd controlling iterm tmux window can still exit tmux, but it does so with a warning message to make it clear what happened.
Provide command line or applescript API for interacting with the iterm tmux Dashboard. This will allow users to script checking what sessions exist. I personally would like to see iterm tmux session management added to Quicksilver for example :). I know this last one is non-trivial :).
Thanks!
dave