# session.Session

- **Module:** session
- **Package:** libtmux
- **Language:** Rust
- **Kind:** struct
- **Source:** https://github.com/libtmux/libtmux-rs/blob/8a648c0894dfffc9303583f753b6c8ae01f2fe76/crates/libtmux/src/session.rs#L105
- **Page:** https://libtmux.org/reference/rs/session-session/

Sessions compare by server endpoint and session id.

Equal-looking ids on different servers are different sessions, and two
handles for the same session remain equal even when their snapshots were
taken at different times.

## Members

- `new` (method) — Build a handle from a hydrated snapshot.
- `from_env` (method) — Find the session this process is running in.
- `from_env_value` (method) — Find a session from an explicit `TMUX_PANE` value.
- `id` (method)
- `name` (method)
- `path` (method)
- `window_count` (method)
- `attached_client_count` (method)
- `is_attached` (method)
- `created` (method)
- `last_attached` (method)
- `server_identity` (method)
- `windows_or_empty` (method) — List the windows linked into this session, in tmux's own order.
- `windows` (method) — List the windows linked into this session, preserving any failure.
- `search_windows_or_empty` (method)
- `search_windows` (method)
- `next_window` (method) — Move to the next window, and return it.
- `previous_window` (method) — Move to the previous window, and return it.
- `last_window` (method) — Move to the window that was active before this one, and return it.
- `active_window` (method) — Return the session's active window.
- `panes_or_empty` (method) — List every pane in this session, in tmux's own order.
- `panes` (method) — List every pane in this session, preserving any failure.
- `refresh` (method) — Replace this handle's snapshot with the session's current state.
- `refreshed` (method) — Return a new handle holding the session's current state.
- `new_window` (method) — Create a window in this session and return it.
- `rename` (method) — Rename the session and update this handle.
- `kill` (method) — Kill the session.
- `cmd` (method) — Run a raw tmux command against this session.
- `format` (method) — Expand a tmux format string in this session's context.
- `display` (method) — Show a message on the clients viewing this session.
- `lock` (method) — Lock every client attached to this session.
- `detach_clients` (method) — Detach every client attached to this session.
- `with_window` (method) — Create a window, run an operation with it, then kill it.
- `window` (method) — Find this session's window with the given name.
- `window_at` (method) — Find this session's window at the given index.
