# libtmux::Session

- **Module:** libtmux
- **Package:** libtmux-cxx
- **Language:** C++
- **Kind:** class
- **Source:** https://github.com/libtmux/libtmux-cxx/blob/393d4b0ad666f18a6581f1eb281741a75a7503f0/include/libtmux/entities.hpp#L362
- **Page:** https://libtmux.org/en/cxx/latest/reference/libtmux-session/

One session, as one listing saw it.

Reads its own fields without touching tmux: the listing ran once, and every value here is that moment's. A window created since is not in `window_count`, and a session killed since still answers.

Equality is the server incarnation and the session id together, so two handles from separate listings of one live server agree, and a handle kept across a restart does not become a handle to whatever reused `$0`.

## Members

- `kNoun` (attribute)
- `kFields` (attribute)
- `Session` (method)
- `id` (method)
- `name` (method)
- `attached` (method): `session_attached` counts clients rather than rendering a flag, so any count other than zero means attached.
- `client_count` (method)
- `window_count` (method)
- `path` (method): The directory a new window starts in, not the shell's current directory.
- `created` (method)
- `group` (method): Empty unless the session belongs to a group sharing its windows.
- `grouped` (method)
- `windows` (method)
- `panes` (method)
- `active_window` (method)
- `active_pane` (method)
- `select_next_window` (method): Move the selection, and answer with the window it landed on.
- `select_previous_window` (method)
- `select_last_window` (method)
- `new_window` (method): Created detached: a library call that stole the terminal would be a surprise, and attaching is a separate decision.
- `rename` (method)
- `kill` (method)
- `refresh` (method)
- `options` (method): Session options.
- `option` (method)
- `set_option` (method)
- `unset_option` (method): Remove the value set here, so the wider scope shows through again.
- `attach_command` (method): A command line that attaches a terminal to this session.
- `detach_clients` (method): Send every client here away, leaving the session running.
- `expand` (method): Ask tmux to expand a format against this session.
- `show_message` (method): Put a message on the status line of every client attached here, and send it to a control client as `message`.
- `hooks` (method)
- `set_hook` (method)
