I've used this snippet to launch tmux when the terminal is launched:
# TMUX startup
if command -v tmux>/dev/null; then
[[ ! $TERM =~ screen ]] && [ -z $TMUX ] && exec tmux
fi
But with this I can't exit tmux without the terminal screen being closed too.
I've tried:
Ctrl + b :detach
exit
And looking for the PID and killing it. All those methods close the terminal too.
How should I configure tmux to start when launching the terminal but still being able to close it without the terminal closing? Any tips are appreciated!