# detach-on-destroy

Source: https://libtmux.org/en/tmux/3.2a/catalog/options/detach-on-destroy/

> If on (the default), the client is detached when the session it is attached to is destroyed.

option tmux3.2a

If on (the default), the client is detached when the session it is attached to is destroyed.

* Scope

  session

* Type

  Choice

* Default

  `on`

* Values

  `off` `on` `no-detached`

* Set

  [`set-option`](https://libtmux.org/en/tmux/3.2a/manual/set-option/) `detach-on-destroy value`

* Read

  [`show-options`](https://libtmux.org/en/tmux/3.2a/manual/show-options/) `detach-on-destroy`

## Description[#](https://libtmux.org/en/tmux/3.2a/catalog/options/detach-on-destroy/#description)

If on (the default), the client is detached when the session it is attached to is destroyed. If off, the client is switched to the most recently active of the remaining sessions. If `no-detached`, the client is detached only if there are no detached sessions; if detached sessions exist, the client is switched to the most recently active.

## Releases[#](https://libtmux.org/en/tmux/3.2a/catalog/options/detach-on-destroy/#releases)

* [tmux 3.7c](https://libtmux.org/en/tmux/3.7c/catalog/options/detach-on-destroy/) : values off, on, no-detached to off, on, no-detached, previous, next
* [tmux 3.2a](https://libtmux.org/en/tmux/3.2a/catalog/options/detach-on-destroy/) : present

## Source[#](https://libtmux.org/en/tmux/3.2a/catalog/options/detach-on-destroy/#source)

* Defined in

  [`options-table.c:413`](https://github.com/tmux/tmux/blob/3b929f332aafa7f1080eacc31feb11ffbb1d1841/options-table.c#L413)

* C source reference

  [`options_table`](https://libtmux.org/en/tmux/3.2a/reference/c-variable-options_table/)

* CLI Manual

  [Original manual entry](https://libtmux.org/en/tmux/3.2a/manual/full/#options-detach-on-destroy)

## Used by[#](https://libtmux.org/en/tmux/3.2a/catalog/options/detach-on-destroy/#used-by)

Library documentation that names this option.

* Rust

  [`options.generated.DETACH_ON_DESTROY`](https://libtmux.org/en/rs/latest/reference/options-generated-detach_on_destroy/)

* Go

  [`tmux.DetachOnDestroy`](https://libtmux.org/en/go/latest/reference/tmux-detachondestroy/), [`tmux.GlobalSessionScope.SetDetachOnDestroy`](https://libtmux.org/en/go/latest/reference/tmux-globalsessionscope-setdetachondestroy/), [`tmux.NotificationStream`](https://libtmux.org/en/go/latest/reference/tmux-notificationstream/), [`tmux.Server.NewSessionConnection`](https://libtmux.org/en/go/latest/reference/tmux-server-newsessionconnection/), [`tmux.Session.OpenControl`](https://libtmux.org/en/go/latest/reference/tmux-session-opencontrol/), [`tmux.Session.SetDetachOnDestroy`](https://libtmux.org/en/go/latest/reference/tmux-session-setdetachondestroy/) and 1 more
