I'm using Gnome Terminal and tmux and I'd like that all tmux sessions were closed when I close the Gnome Terminal, is that possible? I checked the Arch Wiki article on tmux and found some relevant code, but none of them did what I want. Right now, if I close and open the Gnome Terminal I get the the session I had, exactly how it was right before I closed the terminal with all panes and programs running. What I want is that all sessions are killed when I close Gnome Terminal.
Option 1: use
Option 2: Use bash traps.
This option is probably more robust. Put the following code in your
.bash_profile (assuming you use bash).
trap close_tmux EXIT
Links to Additional Resources On Traps