Every terminal window I open automatically attaches to a new tmux session. Closing the shell inside such a tmux session should detach the tmux client for the terminal window to close. This can be done by setting this option:
set -g detach-on-destroy on
However, when I kill the current session from the session overview (Ctrl+b,w,x,y), the tmux client also detaches. Instead, I would like it to stay attached so I can select another session from the session overview.
The question is, how can I have tmux detach when the session exits because the process it's running (i.e. the shell) exits but stay attached when the session is killed from the session overview?