Replacing tmux with exec

I don't think tmux can do that. It should be easy to patch if you know C programming.

One thing you could do is call tmux from a wrapper shell script, and let the script decide whether to exit or not. Send a signal to the wrapper to tell it to execute an interactive shell when tmux exits. Here's an untested proof-of-concept for the wrapper script:

export TMUX_PARENT_PID=$$
trap 'exec bash -i' USR1
tmux

In ~/.tmux.conf:

update-environment DISPLAY WINDOWID SSH_ASKPASS SSH_AUTH_SOCK SSH_AGENT_PID SSH_CONNECTION TMUX_PARENT_PID

From within tmux, to get a shell prompt after detaching:

TMUX_PARENT_PID=$(tmux show-environment | sed -n 's/^TMUX_PARENT_PID=//p')
kill -USR1 $TMUX_PARENT_PID
tmux detach-client

Tags:

Shell

Tmux

Guake