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.

MoreLess about this notice

Concept example A working example of the core library. It can change without notice. What concept means

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
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.

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

Guides

task material

Pages that discuss Invoke-TmuxWorkspace.

In other ports

task equivalence 13 other ports mapped

Source-verified mappings for Build a session from a workspace description. A mapping says these APIs perform the same task. It does not say they share defaults, errors or completion: check each page.

Build a session from a workspace description in each port
PortAPIDiffers from PowerShell
PowerShell LibTmux.Workspace\Invoke-TmuxWorkspace
Apply the exact workspace plan after one confirmation.
This page
Python tmuxp.workspace.builder.ClassicWorkspaceBuilder.build
Build tmux workspace in session.
None recorded in the model
Ruby LibTmux::Workspace::Plan#apply
Behavior: Workspace apply.
None recorded in the model
Julia LibTmuxWorkspace.apply
Applies a prepared WorkspacePlan on an explicit Server, detached and under one deadline. Existing session names fail unless reuse is explicit.
Common Lisp libtmux.workspace:apply-workspace
Apply WORKSPACE through explicit CLIENT and return a WORKSPACE-RESULT. Workspace/1 retains topology-only creation/reuse. Workspace/2 freshly acquires owned state and replans; a preview is never mutation authority. By default owned declaration changes or drift are refused; :RECONCILE permits only the qualified additive, rename, metadata and layout changes. It never adopts an unowned session or repeats an uncertain mutation. RECONCILE requires schema /2.
None recorded in the model
TypeScript builder.applyWorkspace
Build a workspace into a real tmux session, or reconcile one that exists.
async
Rust src.WorkspaceBuilder.build
Create the session a workspace describes, and return it.
async
Go workspace.Build
Build creates the workspace on server and returns the created session.
None recorded in the model
Java io.github.libtmux.workspace.WorkspaceBuilder.build
Creates the described session on a server.
None recorded in the model
C# LibTmux.Workspace.WorkspaceBuilder.BuildAsync
Plans and applies a workspace with the default policies.
async
C++ libtmux::workspace::build None recorded in the model
Swift WorkspaceBuilder.build(_:on:)
Creates the workspace's session and returns it.
async
OCaml Libtmux_unix.Workspace.await
Apply steps at most once per execution handle. Expected failures return retained receipts. On initial application, compensate_on_failure defaults to true, attempting removal of proven newly created panes after failure or cancellation. Passing false skips that compensation. Cancellation propagates after recording progress and at most 500 ms of protected compensation; use inspect afterward.
Apply a validated Plan through submit, then await its retained execution receipt. Inspect preserves partial and late outcomes.
Perl LibTmux::Workspace::load
load(server => $server, existing => 'error'|'skip') uses public LibTmux::Server operations. It checks all session-name conflicts before creation. error rejects any existing target with Conflict; skip leaves that entire session alone, so repeated application creates only absent sessions. A missing server permits explicit creation; other acquisition failures propagate.
Loads through installed public core APIs; existing-target policy and known owned rollback effects are explicit.
No Haskell equivalent.

No public Haskell equivalent is implemented; the current modules expose scalar values and version parsing.

No Raku equivalent.

Workspace functionality is outside the Raku core library scope.

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

Esc
Search in

Type to search.

Reference previewOpen reference