Typically, I use a bash script to create my tmux session (split panes, set PWD, call commands, etc.). This works great, except if I try to run
tmux detach-client. It will fail to detach, instead just adds on extra windows and splits everything up weirdly. Not what is expected.
To duplicate: launch a terminal, and run the script. Then create another terminal in another tab (like in gnome-terminal). Run the script again and it will attach as expected. Finally run
tmux detach-client, and see the results.