# LibTmux.Session

- **Module:** LibTmux
- **Package:** libtmux
- **Language:** Elixir
- **Kind:** struct
- **Source:** https://github.com/libtmux/libtmux-elixir/blob/66b9b1c3f3f3186428abdfda2c76f5cf87446710/lib/libtmux/entities.ex#L1
- **Page:** https://libtmux.org/en/elixir/latest/reference/libtmux-session/

An immutable session observation with explicit actions. Attachment retains tmux's client count.

## Members

### Collections and queries

- [`windows/2`](/en/elixir/latest/reference/libtmux-session-windows-2/) (function): Returns a plain list of captured physical windows in first-link order.
- [`panes/2`](/en/elixir/latest/reference/libtmux-session-panes-2/) (function): Returns a plain list of captured physical panes in numeric pane-ID order.

### Common operations

- [`id`](/en/elixir/latest/reference/libtmux-session-id/) (property): Required: building the struct without this key is an error.
- [`name`](/en/elixir/latest/reference/libtmux-session-name/) (property)
- [`attached`](/en/elixir/latest/reference/libtmux-session-attached/) (property)
- [`active_window/2`](/en/elixir/latest/reference/libtmux-session-active_window-2/) (function): Returns the captured active physical window, or `nil` when none is active.
- [`attached_count`](/en/elixir/latest/reference/libtmux-session-attached_count/) (property)

### Other members

- [`rename!/4`](/en/elixir/latest/reference/libtmux-session-rename-bang-4/) (function): Returns `:ok` when `rename/4` completes; raises API errors or `LibTmux.Action.CompletionError` otherwise.
- [`rename/4`](/en/elixir/latest/reference/libtmux-session-rename-4/) (function): Renames an exact session through the selected transport; returns an action result.
- [`server_instance`](/en/elixir/latest/reference/libtmux-session-server_instance/) (property): Required: building the struct without this key is an error.
- [`t/0`](/en/elixir/latest/reference/libtmux-session-t-0/) (typealias): A session with explicit field coverage and an attachment count separate from its Boolean projection.

## In other ports

### A tmux session

- PowerShell: [`LibTmux\Get-TmuxSession`](/en/powershell/latest/reference/libtmux-get-tmuxsession/) (cmdlet). This cmdlet reads and returns shared .NET `LibTmux.Session` objects. Child windows and panes require further acquisition.
- Julia: [`LibTmux.SessionSnapshot`](/en/julia/latest/reference/libtmux-sessionsnapshot/) (struct). `SessionSnapshot` holds captured session data. Actions use its `SessionRef`, a typed identity bound to an observed daemon generation.
- Python: [`libtmux.Session`](/en/py/latest/reference/libtmux-session/) (class)
- Ruby: [`LibTmux::Session`](/en/ruby/latest/reference/libtmux-session-nvps/) (class)
- Lua: [`libtmux.Session`](/en/lua/latest/reference/libtmux-session/) (class)
- TypeScript: [`session.Session`](/en/ts/latest/reference/session-session/) (class)
- Rust: [`session.Session`](/en/rs/latest/reference/session-session/) (struct)
- Go: [`tmux.Session`](/en/go/latest/reference/tmux-session/) (struct)
- Java: [`io.github.libtmux.Session.Session`](/en/java/latest/reference/io-github-libtmux-session-session/) (class)
- C#: [`LibTmux.Session`](/en/csharp/latest/reference/libtmux-session/) (class)
- C++: [`libtmux::Session`](/en/cxx/latest/reference/libtmux-session/) (class)
- Swift: [`Session`](/en/swift/latest/reference/session/) (struct)
- Kotlin: [`io.github.libtmux.kotlin.Session`](/en/kotlin/latest/reference/io-github-libtmux-kotlin-session/) (class)
- Scala: [`io.github.libtmux.scaladsl.Session`](/en/scala/latest/reference/io-github-libtmux-scaladsl-session/) (typealias)
- F#: [`LibTmux.FSharp.Session`](/en/fsharp/latest/reference/libtmux-fsharp-session/) (module). This F# module builds deferred child queries from a shared .NET `LibTmux.Session` and its server association. `Query.list` acquires their results from tmux.
