Prerelease This site documents an alpha of libtmux. Its structure, URLs and APIs are subject to change.

Edit this page on GitHub

This page describes how the language ports organize their code and where operations live. For the object hierarchy and stable IDs, start with Server, session, window, pane.

Where behavior lives: on the object, or through the serverLink to section

Python, TypeScript, Go, Rust, Java, .NET, and C++ provide operations on session, window, and pane objects. Each object carries its ID and server context. These examples send input, set an option, and kill a pane:

Swift’s Session, Window, and Pane are Sendable value types holding IDs and state fields. Format-token fields lists their fields. Perform operations through Server, passing the target value:

The practical effect is that Server is the one thing you hold onto in a Swift program; a Session or Pane you got back from a snapshot() is inert data you hand back to the server that produced it, not a handle you call things on. Every other port’s Server is also where you start, but Session/Window/Pane stay live actors once you have one.

A generated data table under a hand-written surfaceLink to section

Ports translate object IDs into tmux targets (-t) and read state through tmux’s FORMATS variables (#{...}). Their field definitions use generated catalogs, fixed field sets, or captured dictionaries:

PortGenerated tableHand-written surface
Pythonlibtmux.constants (FORMATS, gated by scope and tmux version)dataclass fields on Obj (libtmux.neo), None when a gate excludes a token
TypeScriptpackages/libtmux/src/_generated/format_fields.ts ({ scope, since, token } per row)camelCase aliases on Pane/Session/Window (packages/libtmux/src/_generated/field_aliases.ts)
Goformat_generated.go, option_generated.go (built by internal/generate/formats)(value, bool) accessor methods: Go’s own “comma ok” idiom for a gate
Rustformats.rs’s per-token macro rows (token, wire name, scope, kind, since version, absent-handling)typed methods returning Option<T>
Java(typed field accessors generated for the query layer: see Pane_/Session_ in Filtering and queries)Optional<T> for fields introduced after a port’s tmux floor
C++, Swiftfixed field sets; see belowa fixed, curated set of non-optional struct/class fields
.NETa snapshot dictionary read at capture timetyped properties that throw IncompleteSnapshotException for a field the capture didn’t request, rather than gating on tmux version per field

Swift and C++ expose fixed sets of state fields. Swift includes indices, dimensions, active state, command, path, and edge flags. C++ declares its fields in kFields arrays and uses pane->expand("#{...}") for other tokens. See Format-token fields for optional fields and tokens outside the fixed sets.

Module layout, by portLink to section

Each port’s own top-level organization, to orient yourself before opening its source:

Naming conventionsLink to section

Method names follow language conventions: Python, Rust, and C++ use snake_case; TypeScript, Java, and Swift use camelCase; Go and .NET use PascalCase. Option and hook names remain tmux’s dash-separated strings, such as automatic-rename, regardless of the method’s spelling.

Esc

Type to search.