Workspace ManagerconceptAPI Reference

Choose documentation 3

latest

Current version

latest
English

Early release libtmux is released, and its APIs may still change between releases. This site's structure and URLs may change too.

Workspace Manager: API Reference

Edit this page on GitHub

Swift workspace builder API

TmuxWorkspace 0.1.1 · Source

Import TmuxWorkspace for the configuration and builder, and LibTmux for the server and returned session value.

Configuration values

Workspace contains the session name, optional working directory, and ordered windows. WindowPlan contains its name, directory, layout, and panes. PanePlan contains its directory and commands. The values conform to Sendable, Hashable, and Codable.

Workspace.decode(json:) reads JSON data. Workspace.decode(yaml:) reads a string only when YAMLWorkspaces is enabled. Encoding these values writes the existing description; it does not query tmux for a live export.

Builder

WorkspaceBuilder exposes the async build(_:on:) operation. It creates a new session on the supplied server and returns a Session. Keep using the server for live observation; session properties do not refresh themselves.

Typed errors

WorkspaceBuilderError distinguishes an empty window list, an existing session name, a vanished session, underlying tmux errors, and failure of rollback.

rollbackFailed(original:cleanup:) preserves both causes. The caller can report the initiating problem and separately inspect whether cleanup left objects behind. The supplied server remains owned by the caller.

Value and decoding contracts; Builder contract.

API declarations

Follow a declaration for its signature, members, documentation, and source.

Exports

PanePlan
One pane, and what to run in it.
TmuxShellCommand
A command to put in a pane, and whether to run it.
WindowPlan
One window, and the panes in it.
Workspace
A tmux layout described as data, in tmuxp's vocabulary.
WorkspaceBuilder
Builds a workspace on a tmux server.
WorkspaceBuilderError
Why a workspace could not be built, including what happened while undoing.
Esc

Type to search.

Reference previewOpen reference