Workspace ManagerAPI Reference

Choose documentation 3

latest

Current version

latest
English

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

LibTmux.Workspace.WorkspaceFile

API reference · Markdown

class LibTmux.Workspace.WorkspaceFile
class [source]

Describes the supported subset of one tmuxp workspace.

Description#

Parsing rejects keys that require tmuxp's Python hooks or plugins. It does not execute or silently discard configuration outside this model.

Discussed in C# workspace builder API

In other ports Describe a workspace as data

Members

WorkspaceFile

WorkspaceFile ( sessionName : string? , startDirectory : string? , options : IReadOnlyDictionary<string, string>? , windows : IReadOnlyList<WorkspaceWindow>? , beforeScript : string? , globalOptions : IReadOnlyDictionary<string, string>? )
method [source]

Initializes a workspace description.

Parameters
Raises

Environment

property [source]

Gets the environment entries contributed by this declaration.

ShellCommandsBefore

ShellCommandsBefore : IReadOnlyList<string>
property [source]

Gets the commands prepended at this declaration level.

BeforeCommands

BeforeCommands : IReadOnlyList<WorkspaceCommand>
property [source]

Gets the typed commands prepended at this declaration level.

WithDefaults

WithDefaults ( environment : IReadOnlyDictionary<string, string>? , shellCommandsBefore : IReadOnlyList<string>? , beforeCommands : IReadOnlyList<WorkspaceCommand>? ) → WorkspaceFile
method [source]

Returns a declaration with replacement environment and pre-command defaults.

Parameters
Returns

A new declaration; empty collections clear the corresponding defaults.

Raises
  • ArgumentException – An environment name is empty or contains '=' or NUL, or a value contains NUL.

SessionName

SessionName : string?
property [source]

Gets the session name.

StartDirectory

StartDirectory : string?
property [source]

Gets the directory its windows start in.

Options

property [source]

Gets the session options to set.

GlobalOptions

GlobalOptions : IReadOnlyDictionary<string, string>
property [source]

Gets the global session options to set before creating the declared windows.

Description#

These can affect other sessions that inherit them and are not reversed by compensation.

Windows

property [source]

Gets the windows to create, in order.

BeforeScript

BeforeScript : string?
property [source]

Gets the host command retained without expansion or execution by parsing or resolution.

DocumentDirectory

DocumentDirectory : string?
property [source]

Gets the absolute document directory supplied to resolution, or null before resolution.

Resolve

Resolve ( baseDirectory : string , variables : IReadOnlyDictionary<string, string>? ) → WorkspaceFile
method [source]

Resolves inherited pane directories against an explicit document base.

Description#

Resolves relative paths against the parent declaration's directory. Expansion accepts $NAME, ${NAME}, and a leading ~ using the supplied HOME variable; $$ produces a literal dollar sign. Session, window and pane option values expand supplied variables; unknown variables remain literal. Resolution reads neither the process environment nor the filesystem. The builder treats resolved directories as literal paths, including tmux format characters. Commands, the host script, names and environment values remain literal. Failures retain the original YAML or JSON value's line and column when the declaration was parsed.

Parameters
  • baseDirectory ( string ) – The absolute directory containing the declaration.

  • variables ( IReadOnlyDictionary<string, string>? ) – The only variables available to directory and option-value expansion.

Returns

A new declaration with absolute inherited directories and its document directory.

Raises

Discussed in C# workspace builder behavior

FromSnapshot

FromSnapshot ( session : Session ) → WorkspaceFile
methodstatic [source]

Creates a workspace declaration from a captured session without reaching tmux.

Description#

Preserves captured window placements and pane order, names, layouts, and focus. Repeated links become separate declared windows. Captured pane directories escape literal dollars for a later explicit Resolve ; captured null paths remain unspecified. Commands, environment, options, terminal text, entity identifiers, pane indices, and shared-link identity are not reconstructed. Foreground command names do not establish shell intent. Restoring a native custom layout can change which pane occupies a position; see SelectLayoutAsync .

Parameters
  • session ( Session ) – The session with captured windows, panes, and active pane relations.

Returns

An unresolved declaration without a document directory.

Raises

Parse

Parse ( yaml : string ) → WorkspaceFile
methodstatic [source]

Reads a workspace from tmuxp YAML or JSON.

Parameters
  • yaml ( string ) – The file contents.

Returns

The parsed workspace.

Raises
  • WorkspaceFormatException – The input is too large, malformed, contains more than one document, or uses a key or value shape outside the supported subset.

Discussed in C# workspace internals , Use the C# workspace builder , C# workspace builder behavior

Esc

Type to search.