So when I open a new terminal (I use terminator on Arch Linux), I have it configured to either open a new
tmux session if one doesn't exist, or attach to an existing one. When I type
exit at the prompt, it quits the tmux session. I have to type
exit again to quit the terminal. What I want is that typing
exit once will quit the terminal, but leave
tmux running, so the next time I open the terminal it will reattach to the previous
tmux session. Essentially, this is the equivalent of clicking the exit button for the window manager, but I want this functionality when typing
This is something like what I want:
alias exit='if [[ $TMUX = "" ]]; then exit; else tmux detach; exit; fi'
but the issue is the
exit after the
tmux detach should get called in the terminal containing the tmux session, not the tmux session itself.