Workspace ManagerconceptAPI Reference

Choose documentation 2

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.

LibTmux.Workspace\Invoke-TmuxWorkspace

Apply the exact workspace plan after one confirmation.

Description#

Apply the supplied native WorkspacePlan using its own endpoint, observed identities and frozen actions. No declaration, file, endpoint or policy can be substituted at invocation. Stale preconditions fail; invocation never replans or retries mutations automatically.

One PowerShell ShouldProcess decision covers the whole plan. Its target names the executable, socket and literal session name. Its action describes conflict, startup, readiness and compensation policy, global option effects, then lists every action and conditional cleanup step in order by kind and symbolic target. Option actions disclose scope and whether they change global defaults; request values are omitted. Inspect the original plan for full request and host-command values. WhatIf and declined confirmation perform no application I/O or cleanup and emit no WorkspaceResult.

Successful invocation returns one native WorkspaceResult containing the session, created windows, unsupported layouts and action journals. WorkspaceBuildException remains ErrorRecord.Exception under Tmux.WorkspaceApplyFailed, with the original plan as TargetObject. Inspect its Dispatch, InnerException, PartialResult, Journal and CompensationJournal; partial results are never emitted as success.

Stopping the pipeline cancels owned work. Cleanup follows the plan's frozen budget. A stopped pipeline can suppress subsequent error output, so receiving a cancellation journal after pipeline shutdown is not guaranteed. Application is detached; it does not attach a terminal or transfer ownership of the daemon. To enter the applied session, pass the successful WorkspaceResult.Session to Enter-TmuxSession in a foreground terminal outside tmux. Attachment has its own confirmation and cancellation behavior; it does not repeat application.

Notes

Replace is an explicit planning policy. Compensation can remove only creations whose ownership is established by the native journal; shell and host-script effects cannot be undone. Reuse returns the existing session without running workspace mutation or host actions. A window name with a colon or a period on exactly tmux 3.7 reports LibTmux.TmuxUnsupportedOnReleaseException before the first action creates anything.

Command details#

Command type
cmdlet
Confirmation
Supports -WhatIf and -Confirm; confirm impact: High.
Positional binding
Enabled.
Pipeline inputs
LibTmux.Workspace.WorkspacePlan: A native plan prepared by Get-TmuxWorkspacePlan or the shared .NET API.
Outputs
LibTmux.Workspace.WorkspaceResult

Examples#

Example 1 Preview an existing plan created by Get-TmuxWorkspacePlan without applying it. View source

Terminal window
$Plan | LibTmux.Workspace\Invoke-TmuxWorkspace -WhatIf

Example 2 Apply that reviewed plan with the normal confirmation explicitly disabled. View source

Terminal window
$Plan | LibTmux.Workspace\Invoke-TmuxWorkspace -Confirm:$false
Parameters
Common parameters 12

PowerShell supplies these parameters. See common parameter behavior for their effects.

Returns

LibTmux.Workspace.WorkspaceResult: One completed native result. Preview and declined confirmation emit nothing.

Guides#

Pages that discuss Invoke-TmuxWorkspace.

Workspace

In other ports#

Build a session from a workspace description

Equivalents of Build a session from a workspace description in other languages
Language Equivalent
Python tmuxp.workspace.builder.ClassicWorkspaceBuilder.build
Ruby LibTmux::Workspace::Plan#apply
Julia LibTmuxWorkspace.apply Applies a prepared WorkspacePlan on an explicit Server, detached and under one deadline. Existing session names fail unless reuse is explicit.
TypeScript builder.applyWorkspace
Rust src.WorkspaceBuilder.build
Go workspace.Build
Java io.github.libtmux.workspace.WorkspaceBuilder.build
C# LibTmux.Workspace.WorkspaceBuilder.BuildAsync
C++ libtmux::workspace::build
Swift WorkspaceBuilder.build(_:on:)

No equivalent is recorded in Lua, Elixir, Kotlin, Scala or F#.

Esc

Type to search.

Reference previewOpen reference