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

Go workspace builder API

github.com/libtmux/libtmux-go/workspace · Source

The workspace module takes core tmux.Server and session handles. Parsing is independent of a running server; building takes a context for deadlines and cancellation.

Parse configuration

Parse reads YAML into a Workspace. Its errors match ErrInvalidWorkspace. Inspect the individual diagnostics to locate unknown keys or invalid values.

Window, Pane, and Command let applications construct the same data in Go. Bool preserves tmuxp’s supported boolean spellings.

Build a session

Build creates the initial session and owns a temporary control connection for the duration of construction. It returns a session and an error; a non-nil error can accompany a partial session.

BuildInto populates a supplied session and preserves the caller’s connection ownership. Workspace.InitialSessionRequest produces the initial request for that workflow.

Inspect before and after

Workspace.MissingDirectories reports working directories absent on the current machine. It does not make them validation errors. After construction, inspect live state through the core API rather than reading relations from the creation handle.

Build contracts; Configuration contracts.

API declarations

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

Workspace files

workspace.Bool
Bool accepts YAML booleans and tmuxp's quoted spellings. It is exported so callers can construct optional *Bool fields.
workspace.Command
Command is one command to run in a pane. YAML accepts either a bare string or a mapping, so "echo hi" and {cmd: echo hi, sleep_before: 2} are both commands.
workspace.Pane
Pane is one pane in a window. YAML accepts either a bare command string or a mapping, so "echo hello" and {shell_command: echo hello} are equivalent.
workspace.Parse
Parse decodes one workspace document. Unknown fields are rejected so a misspelled key fails loudly instead of being dropped.
workspace.Window
Window is one window in a workspace.
workspace.Workspace
Workspace is one tmuxp-style session description.

Building and freezing

workspace.Build
Build creates the workspace on server and returns the created session.
workspace.BuildInto
BuildInto populates the initial session described by workspace. The session must already have been created from Workspace.InitialSessionRequest. BuildInto uses the session's existing server and transport; it neither creates a session nor opens or owns a connection.

Errors

workspace.ErrInvalidWorkspace
ErrInvalidWorkspace matches parse and validation failures, but not tmux command failures from Build.
Esc

Type to search.

Reference previewOpen reference