# LibTmux.Session

- **Module:** LibTmux
- **Package:** LibTmux
- **Language:** .NET
- **Kind:** class
- **Source:** https://github.com/libtmux/libtmux-dotnet/blob/320dc64f4b8b7815842471327a5e6b84a1499bf8/src/LibTmux/Session.cs#L9
- **Page:** https://libtmux.org/en/dotnet/latest/reference/libtmux-session/

Represents an immutable session handle and snapshot.

Thread-safe: the handle is immutable once constructed and may be shared
freely, including as a singleton. Every mutating call answers a new handle
rather than changing this one.

## Members

- `ExecuteCommandAsync` (method): Executes one raw tmux command against this session.
- `FromEnvironmentAsync` (method): Returns the session holding the pane this process runs in.
- `RawFormatFields` (property): Gets the tmux fields captured when this handle materialized.
- `Id` (property): Gets the session identifier.
- `Generation` (property): Gets the server generation captured with this session.
- `Equals` (method)
- `GetHashCode` (method)
- `Name` (property): Gets the session name captured with this handle.
- `Attached` (property): Gets whether a client was attached when this session was read.
- `Server` (property): Gets the server that owns this session.
- `RefreshAsync` (method): Re-reads this session from tmux.
- `RenameAsync` (method): Renames this session.
- `KillAsync` (method): Stops this session.
- `LockAsync` (method): Locks this session.
- `DetachClientAsync` (method): Detaches every client attached to this session.
- `SelectWindowAsync` (method): Selects a window in this session.
- `SelectNextWindowAsync` (method): Selects the next window.
- `SelectPreviousWindowAsync` (method): Selects the previous window.
- `KillWindowAsync` (method): Stops one window in this session.
- `SwitchClientAsync` (method): Switches the current client to this session.
- `SearchWindowsAsync` (method): Runs a tmux-side filter over this session's windows.
- `SearchPanesAsync` (method): Runs a tmux-side filter over this session's panes.
- `AttachAsync` (method): Attaches a client to this session.
- `CreateWindowAsync` (method): Creates a window in this session.
- `ActiveWindow` (property): Gets the captured active window, or an uncaptured relation.
- `ActivePane` (property): Gets the captured active pane, or an uncaptured relation.
- `Windows` (property): Gets the windows the capture found in this session.
- `Panes` (property): Gets the panes the capture found in this session.
- `GetWindowAsync` (method): Reads one window in this session, throwing when it is absent.
- `FindWindowAsync` (method): Reads one of this session's windows by identifier.
- `GetWindowsAsync` (method): Reads this session's windows from tmux.
- `GetPanesAsync` (method): Reads this session's panes from tmux.
- `Options` (property): Gets the options of this session.
- `Hooks` (property): Gets the hooks of this session.
- `Environment` (property): Gets the environment panes created in this session inherit from.
- `SelectLastWindowAsync` (method): Selects the window that was last active.
- `CreateOwnedWindowAsync` (method): Creates a window in this session and takes ownership of it.
