Workspace ManagerconceptAPI Reference

Choose documentation 2

latest

Current version

latest
English

Unreleased LibTmux has not been released. Its API may change during development. This site's structure and URLs may change too.

Workspace Manager: API Reference

LibTmux::Workspace::load

sub load($self, %args)

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.

Description#

Return one report containing created IDs, skipped names, and completed steps. On failure, rollback only sessions returned by successful creation, then throw Load with original cause and partial-effect report. An uncertain creation without a returned ID cannot be rolled back safely. Existing resources are never rollback targets. Layouts apply after splitting; working directories and environments reach every initial process. Completion means command acceptance and captured state, not application readiness.

Methods#

Examples#

Complete installed-package program with an owned tmux fixture and result/cleanup assertions. View source

use v5.44;
use FindBin;
use lib "$FindBin::Bin/../scripts/lib";
use LibTmuxFixture;
use LibTmux::Workspace;
LibTmuxFixture->run(
sub ($server, $root) {
my $workspace = LibTmux::Workspace->new(
config => {
schema => 'libtmux.workspace/v1',
sessions => [
{
name => 'workspace-example',
windows => [
{
name => 'api',
cwd => $root,
layout => 'even-horizontal',
panes => [
{command => ['/bin/sleep', '120']},
{
command => ['/bin/sleep', '120'],
horizontal => true
},
],
}
],
}
],
}
);
die 'plan mutated state' if $workspace->plan->{mutates};
my $loaded = $workspace->load(server => $server);
die 'load failed' unless $loaded->{status} eq 'loaded';
die 'panes missing' unless $server->snapshot->panes->count == 2;
die 'repeat did not skip'
unless $workspace->load(server => $server, existing => 'skip')
->{skipped}->@* == 1;
say 'workspace load and repeat: ok';
}
);
Parameters

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
PowerShell LibTmux.Workspace\Invoke-TmuxWorkspace Applies the exact reviewed -Plan after PowerShell confirmation. -WhatIf previews without applying it; application is detached.
Julia LibTmuxWorkspace.apply Applies a prepared WorkspacePlan on an explicit Server, detached and under one deadline. Existing session names fail unless reuse is explicit.
Haskell No public Haskell equivalent is implemented; the current modules expose scalar values and version parsing.
Common Lisp libtmux.workspace:apply-workspace
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:)
OCaml Libtmux_unix.Workspace.await Apply a validated Plan through submit, then await its retained execution receipt. Inspect preserves partial and late outcomes.

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

Esc

Type to search.

Reference previewOpen reference