LibTmux.Workspace.WorkspaceFile
-
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
- Python tmuxp uses configuration dictionaries rather than a dedicated workspace value type
- Ruby
LibTmux::Workspace - Lua No source-verified Lua equivalent is recorded for this operation.
- TypeScript
config.Workspace - Rust
config.Workspace - Go
workspace.Workspace - Java
io.github.libtmux.workspace.Workspace - C++
libtmux::workspace::Workspace - Swift
Workspace - Kotlin No source-verified Kotlin equivalent is recorded for this operation.
- Scala No source-verified Scala equivalent is recorded for this operation.
- F# No source-verified F# equivalent is recorded for this operation.
Members
- WorkspaceFile ( sessionName : string? , startDirectory : string? , options : IRead
Only <string, string>? , windows : IReadDictionary Only <WorkspaceList Window >? , beforeScript : string? , globalOptions : IReadOnly <string, string>? )Dictionary -
Initializes a workspace description.
- Parameters
-
-
sessionName ( string? ) – The session name.
-
startDirectory ( string? ) – The directory its windows start in.
-
options ( IRead
Only <string, string>? ) – The session options to set.Dictionary -
windows ( IRead
Only <WorkspaceList Window >? ) – The windows to create, in order. -
beforeScript ( string? ) – The host command retained for explicitly enabled execution.
-
globalOptions ( IRead
Only <string, string>? ) – The global session options to set before creating the declared windows.Dictionary
-
- Raises
-
-
Argument
Exception – The host command is blank or contains NUL.
-
- Environment : IRead
Only <string, string>Dictionary -
Gets the environment entries contributed by this declaration.
- ShellCommandsBefore : IRead
Only <string>List -
Gets the commands prepended at this declaration level.
- BeforeCommands : IRead
Only <WorkspaceList Command > -
Gets the typed commands prepended at this declaration level.
- WithDefaults ( environment : IRead
Only <string, string>? , shellCommandsBefore : IReadDictionary Only <string>? , beforeCommands : IReadList Only <WorkspaceList Command >? ) WorkspaceFile -
Returns a declaration with replacement environment and pre-command defaults.
- Parameters
-
-
environment ( IRead
Only <string, string>? ) – The local entries to copy, or null to preserve the existing entries.Dictionary -
shellCommandsBefore ( IRead
Only <string>? ) – The local commands to copy, or null to preserve the existing commands.List -
beforeCommands ( IRead
Only <WorkspaceList Command >? ) – Typed local commands; use instead ofshellCommandsBefore.
-
- Returns
-
A new declaration; empty collections clear the corresponding defaults.
- Raises
-
-
Argument
Exception – An environment name is empty or contains '=' or NUL, or a value contains NUL.
-
-
Gets the session name.
-
Gets the directory its windows start in.
- Options : IRead
Only <string, string>Dictionary -
Gets the session options to set.
- GlobalOptions : IRead
Only <string, string>Dictionary -
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 : IRead
Only <WorkspaceList Window > -
Gets the windows to create, in order.
-
Gets the host command retained without expansion or execution by parsing or resolution.
-
Gets the absolute document directory supplied to resolution, or null before resolution.
- Resolve ( baseDirectory : string , variables : IRead
Only <string, string>? ) WorkspaceDictionary File -
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 ( IRead
Only <string, string>? ) – The only variables available to directory and option-value expansion.Dictionary
-
- Returns
-
A new declaration with absolute inherited directories and its document directory.
- Raises
-
-
Argument
Exception – The document base is not absolute. -
Workspace
Format – A directory or expansion is invalid.Exception
-
Discussed in C# workspace builder behavior
- FromSnapshot ( session : Session ) Workspace
File -
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; seeSelectLayoutAsync.- Parameters
-
-
session ( Session ) – The session with captured windows, panes, and active pane relations.
-
- Returns
-
An unresolved declaration without a document directory.
- Raises
-
-
Argument
Null – The session is null.Exception -
Incomplete
Snapshot – A required field or relation was not captured.Exception -
Tmux
Protocol – A captured window active flag is malformed.Exception
-
- Parse ( yaml : string ) Workspace
File -
Reads a workspace from tmuxp YAML or JSON.
- Parameters
-
-
yaml ( string ) – The file contents.
-
- Returns
-
The parsed workspace.
- Raises
-
-
Workspace
Format – The input is too large, malformed, contains more than one document, or uses a key or value shape outside the supported subset.Exception
-
Discussed in C# workspace internals , Use the C# workspace builder , C# workspace builder behavior