Workspace ManagerconceptHome

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

Edit this page on GitHub

tmux workspace manager, forged in PowerShell.

Session manager for tmux. Load and convert tmux sessions through YAML/JSON configuration files. Powered by libtmux for PowerShell.

Explore tmux layout / workspace possibilities

Preset
Short-hand panesTwo panesThree panesFour panesMain-horizontal layoutSetup before each paneEnvironmentStart directorySynchronized panesMain pane height as a percentageMinimal workspacetmux optionsSkip Enter for a commandSkip Enter for a paneWindow index

session_name: shorthands
windows:
- window_name: long form
panes:
- shell_command:
- echo 'did you know'
- echo 'you can inline'
- shell_command: echo 'single commands'
- echo 'for panes'
{
"session_name": "shorthands",
"windows": [
{
"window_name": "long form",
"panes": [
{
"shell_command": [
"echo 'did you know'",
"echo 'you can inline'"
]
},
{
"shell_command": "echo 'single commands'"
},
"echo 'for panes'"
]
}
]
}
Window 0, long form: 3 panes, even-vertical❯ echo 'did you know'❯ echo 'you can inline'❯ echo 'single commands'❯ echo 'for panes'
no layout set
session_name: 2-pane-vertical
windows:
- window_name: my test window
panes:
- echo hello
- echo hello
{
"session_name": "2-pane-vertical",
"windows": [
{
"window_name": "my test window",
"panes": [
"echo hello",
"echo hello"
]
}
]
}
Window 0, my test window: 2 panes, even-vertical❯ echo hello❯ echo hello
no layout set
session_name: 3-panes
windows:
- window_name: dev window
layout: main-vertical
shell_command_before:
- cd ~/
panes:
- shell_command:
- cd /var/log
- ls -al | grep \.log
- echo hello
- echo hello
{
"session_name": "3-panes",
"windows": [
{
"window_name": "dev window",
"layout": "main-vertical",
"shell_command_before": [
"cd ~/"
],
"panes": [
{
"shell_command": [
"cd /var/log",
"ls -al | grep \\.log"
]
},
"echo hello",
"echo hello"
]
}
]
}
Window 0, dev window: 3 panes, main-vertical❯ cd /var/log❯ ls -al | grep \.log❯ echo hello❯ echo hello
layout main-vertical
session_name: 4-pane-split
windows:
- window_name: dev window
layout: tiled
shell_command_before:
- cd ~/
panes:
- shell_command:
- cd /var/log
- ls -al | grep \.log
- echo hello
- echo hello
- echo hello
{
"session_name": "4-pane-split",
"windows": [
{
"window_name": "dev window",
"layout": "tiled",
"shell_command_before": [
"cd ~/"
],
"panes": [
{
"shell_command": [
"cd /var/log",
"ls -al | grep \\.log"
]
},
"echo hello",
"echo hello",
"echo hello"
]
}
]
}
Window 0, dev window: 4 panes, tiled❯ cd /var/log❯ ls -al | grep \.log❯ echo hello❯ echo hello❯ echo hello
layout tiled
session_name: test window options
start_directory: '~'
windows:
- layout: main-horizontal
options:
main-pane-height: 5
panes:
- pane
- pane
- pane
window_name: editor
{
"session_name": "test window options",
"start_directory": "~",
"windows": [
{
"layout": "main-horizontal",
"options": {
"main-pane-height": 5
},
"panes": [
"pane",
"pane",
"pane"
],
"window_name": "editor"
}
]
}
Window 0, editor: 3 panes, main-horizontal
layout main-horizontal
session_name: corpus
start_directory: ${PROJECT_ROOT}
options:
default-command: exec /bin/sh
'@corpus-session': yaml-original
environment:
CORPUS_SESSION: yaml-root
CORPUS_LAYER: session
shell_command_before:
- cmd: echo session >> order.txt
windows:
- window_name: yaml-editor
start_directory: window
layout: even-horizontal
focus: true
options:
'@corpus-window': '${OPTION_TAG}'
environment:
CORPUS_WINDOW: yaml-window
CORPUS_LAYER: window
shell_command_before:
- cmd: echo window >> order.txt
panes:
- shell_command:
- cmd: echo command >> order.txt
- 'echo "$CORPUS_SESSION|$CORPUS_WINDOW|$CORPUS_PANE|$CORPUS_LAYER" > environment.txt'
- tmux wait-for -S corpus-yaml-first
- start_directory: pane
focus: true
options:
'@corpus-pane': yaml
environment:
CORPUS_PANE: yaml-pane
CORPUS_LAYER: pane
shell_command_before:
- cmd: echo pane >> order.txt
shell_command:
- echo command >> order.txt
- 'echo "$CORPUS_SESSION|$CORPUS_WINDOW|$CORPUS_PANE|$CORPUS_LAYER" > environment.txt'
- tmux wait-for -S corpus-yaml-second
{
"session_name": "corpus",
"start_directory": "${PROJECT_ROOT}",
"options": {
"default-command": "exec /bin/sh",
"@corpus-session": "yaml-original"
},
"environment": {
"CORPUS_SESSION": "yaml-root",
"CORPUS_LAYER": "session"
},
"shell_command_before": [
{
"cmd": "echo session >> order.txt"
}
],
"windows": [
{
"window_name": "yaml-editor",
"start_directory": "window",
"layout": "even-horizontal",
"focus": true,
"options": {
"@corpus-window": "${OPTION_TAG}"
},
"environment": {
"CORPUS_WINDOW": "yaml-window",
"CORPUS_LAYER": "window"
},
"shell_command_before": [
{
"cmd": "echo window >> order.txt"
}
],
"panes": [
{
"shell_command": [
{
"cmd": "echo command >> order.txt"
},
"echo \"$CORPUS_SESSION|$CORPUS_WINDOW|$CORPUS_PANE|$CORPUS_LAYER\" > environment.txt",
"tmux wait-for -S corpus-yaml-first"
]
},
{
"start_directory": "pane",
"focus": true,
"options": {
"@corpus-pane": "yaml"
},
"environment": {
"CORPUS_PANE": "yaml-pane",
"CORPUS_LAYER": "pane"
},
"shell_command_before": [
{
"cmd": "echo pane >> order.txt"
}
],
"shell_command": [
"echo command >> order.txt",
"echo \"$CORPUS_SESSION|$CORPUS_WINDOW|$CORPUS_PANE|$CORPUS_LAYER\" > environment.txt",
"tmux wait-for -S corpus-yaml-second"
]
}
]
}
]
}
Window 0, yaml-editor: 2 panes, even-horizontal❯ echo command >> order.txt❯ echo "$CORPUS_SESSION|$CORPUS_WINDOW|$CORPUS_PANE|$CORPUS_LAYER" > environment.txt❯ tmux wait-for -S corpus-yaml-first❯ echo command >> order.txt❯ echo "$CORPUS_SESSION|$CORPUS_WINDOW|$CORPUS_PANE|$CORPUS_LAYER" > environment.txt❯ tmux wait-for -S corpus-yaml-second
layout even-horizontal
session_name: test env vars
start_directory: "~"
environment:
FOO: SESSION
PATH: /tmp
windows:
- window_name: no_overrides
panes:
- pane
- window_name: window_overrides
environment:
FOO: WINDOW
panes:
- pane
- window_name: pane_overrides
panes:
- environment:
FOO: PANE
- window_name: both_overrides
environment:
FOO: WINDOW
panes:
- pane
- environment:
FOO: PANE
# This test case it just needed for warnings issued in old versions of tmux.
- window_name: both_overrides_on_first_pane
environment:
FOO: WINDOW
panes:
- environment:
FOO: PANE
{
"session_name": "test env vars",
"start_directory": "~",
"environment": {
"FOO": "SESSION",
"PATH": "/tmp"
},
"windows": [
{
"window_name": "no_overrides",
"panes": [
"pane"
]
},
{
"window_name": "window_overrides",
"environment": {
"FOO": "WINDOW"
},
"panes": [
"pane"
]
},
{
"window_name": "pane_overrides",
"panes": [
{
"environment": {
"FOO": "PANE"
}
}
]
},
{
"window_name": "both_overrides",
"environment": {
"FOO": "WINDOW"
},
"panes": [
"pane",
{
"environment": {
"FOO": "PANE"
}
}
]
},
{
"window_name": "both_overrides_on_first_pane",
"environment": {
"FOO": "WINDOW"
},
"panes": [
{
"environment": {
"FOO": "PANE"
}
}
]
}
]
}
Window 0, no_overrides: 1 pane, even-vertical
no layout set
Window 1, window_overrides: 1 pane, even-vertical
no layout set
Window 2, pane_overrides: 1 pane, even-vertical
no layout set
Window 3, both_overrides: 2 panes, even-vertical
no layout set
Window 4, both_overrides_on_first_pane: 1 pane, even-vertical
no layout set
session_name: sample workspace
windows:
- panes:
- start_directory: /usr
- start_directory: /etc
{
"session_name": "sample workspace",
"windows": [
{
"panes": [
{
"start_directory": "/usr"
},
{
"start_directory": "/etc"
}
]
}
]
}
Window 0: 2 panes, even-vertical
no layout set
session_name: 2-pane-synchronized
windows:
- window_name: Two synchronized panes
panes:
- ssh server1
- ssh server2
options_after:
synchronize-panes: on
{
"session_name": "2-pane-synchronized",
"windows": [
{
"window_name": "Two synchronized panes",
"panes": [
"ssh server1",
"ssh server2"
],
"options_after": {
"synchronize-panes": "on"
}
}
]
}
Window 0, Two synchronized panes: 2 panes, even-vertical❯ ssh server1❯ ssh server2
no layout set
session_name: main-pane-height
start_directory: "~"
windows:
- layout: main-horizontal
options:
main-pane-height: 67%
panes:
- shell_command:
- top
start_directory: "~"
- shell_command:
- echo "hey"
- shell_command:
- echo "moo"
window_name: my window name
{
"session_name": "main-pane-height",
"start_directory": "~",
"windows": [
{
"layout": "main-horizontal",
"options": {
"main-pane-height": "67%"
},
"panes": [
{
"shell_command": [
"top"
],
"start_directory": "~"
},
{
"shell_command": [
"echo \"hey\""
]
},
{
"shell_command": [
"echo \"moo\""
]
}
],
"window_name": "my window name"
}
]
}
Window 0, my window name: 3 panes, main-horizontal❯ top❯ echo "hey"❯ echo "moo"
layout main-horizontal
session_name: My tmux session
windows:
- panes:
-
{
"session_name": "My tmux session",
"windows": [
{
"panes": [
null
]
}
]
}
Window 0: 1 pane, even-vertical
no layout set
session_name: test window options
start_directory: "~"
global_options:
default-shell: /bin/sh
default-command: /bin/sh
options:
main-pane-height: ${MAIN_PANE_HEIGHT} # works with env variables
windows:
- layout: main-horizontal
options:
automatic-rename: on
panes:
- shell_command:
- man echo
start_directory: "~"
- shell_command:
- echo "hey"
- shell_command:
- echo "moo"
{
"session_name": "test window options",
"start_directory": "~",
"global_options": {
"default-shell": "/bin/sh",
"default-command": "/bin/sh"
},
"options": {
"main-pane-height": "${MAIN_PANE_HEIGHT}"
},
"windows": [
{
"layout": "main-horizontal",
"options": {
"automatic-rename": "on"
},
"panes": [
{
"shell_command": [
"man echo"
],
"start_directory": "~"
},
{
"shell_command": [
"echo \"hey\""
]
},
{
"shell_command": [
"echo \"moo\""
]
}
]
}
]
}
Window 0: 3 panes, main-horizontal❯ man echo❯ echo "hey"❯ echo "moo"
layout main-horizontal
session_name: Skip command execution (command-level)
windows:
- panes:
- shell_command:
# You can see this
- echo "___$((11 + 1))___"
# This is skipped
- cmd: echo "___$((1 + 3))___"
enter: false
{
"session_name": "Skip command execution (command-level)",
"windows": [
{
"panes": [
{
"shell_command": [
"echo \"___$((11 + 1))___\"",
{
"cmd": "echo \"___$((1 + 3))___\"",
"enter": false
}
]
}
]
}
]
}
Window 0: 1 pane, even-vertical❯ echo "___$((11 + 1))___"❯ echo "___$((1 + 3))___"
no layout set
session_name: Skip command execution (pane-level)
windows:
- panes:
- shell_command: echo "___$((1 + 3))___"
enter: false
- shell_command:
- echo "___$((1 + 3))___"\;
- echo "___$((1 + 3))___"
enter: false
{
"session_name": "Skip command execution (pane-level)",
"windows": [
{
"panes": [
{
"shell_command": "echo \"___$((1 + 3))___\"",
"enter": false
},
{
"shell_command": [
"echo \"___$((1 + 3))___\"\\;",
"echo \"___$((1 + 3))___\""
],
"enter": false
}
]
}
]
}
Window 0: 2 panes, even-vertical❯ echo "___$((1 + 3))___"❯ echo "___$((1 + 3))___"\;❯ echo "___$((1 + 3))___"
no layout set
session_name: Window index example
windows:
- window_name: zero
panes:
- echo "this window's index will be zero"
- window_name: five
panes:
- echo "this window's index will be five"
window_index: 5
- window_name: one
panes:
- echo "this window's index will be one"
{
"session_name": "Window index example",
"windows": [
{
"window_name": "zero",
"panes": [
"echo \"this window's index will be zero\""
]
},
{
"window_name": "five",
"panes": [
"echo \"this window's index will be five\""
],
"window_index": 5
},
{
"window_name": "one",
"panes": [
"echo \"this window's index will be one\""
]
}
]
}
Window 0, zero: 1 pane, even-vertical❯ echo "this window's index will be zero"
no layout set
Window 1, one: 1 pane, even-vertical❯ echo "this window's index will be one"
no layout set
Window 5, five: 1 pane, even-vertical❯ echo "this window's index will be five"
no layout set

Install

Install the workspace package separately from the core library.

PowerShell
PowerShell
LibTmux.Workspace 0.1.0 concept PowerShell Gallery
PS> Install-Module -Name LibTmux.Workspace
PS> Install-PSResource -Name LibTmux.Workspace

Installs the matching LibTmux core dependency. Run PowerShell and tmux on the same Unix host.

Installs the matching LibTmux core dependency. Run PowerShell and tmux on the same Unix host.

LibTmux.Workspace provides PowerShell commands for reading, validating, planning and applying workspace configuration. The module uses LibTmux for tmux objects and operations.

Install the module with the commands below, then follow the workspace guide to inspect a plan before applying it. The command reference lists every exported workspace command and its parameter sets.

The PowerShell Gallery package also provides Azure Automation and manual download options. Manual downloads require you to install the package dependencies separately.

Example workspaces

Each workspace below is a file that libtmux/libtmux-powershell loads in a test or a scheduled run, as the list under it says. The drawing shows the panes of each window and the commands each pane receives.

Short-hand panes

A pane can be one command written as a string, and a command list can be one string.

session_name: shorthands
windows:
- window_name: long form
panes:
- shell_command:
- echo 'did you know'
- echo 'you can inline'
- shell_command: echo 'single commands'
- echo 'for panes'
{
"session_name": "shorthands",
"windows": [
{
"window_name": "long form",
"panes": [
{
"shell_command": [
"echo 'did you know'",
"echo 'you can inline'"
]
},
{
"shell_command": "echo 'single commands'"
},
"echo 'for panes'"
]
}
]
}

Converted from the YAML; the tests load the YAML.

0:long form
Window 0, long form: 3 panes, even-vertical❯ echo 'did you know'❯ echo 'you can inline'❯ echo 'single commands'❯ echo 'for panes'
no layout set

Same file as tmuxp's examples/shorthands.yaml.

Source: tests/fixtures/workspace/tmuxp-v1.74.0-shorthands.yaml

Loaded by:

  • tmuxp example catalog: Imports the file with Import-TmuxWorkspace. Starts no tmux. (tests/WorkspaceFiles.Tests.ps1; loaded by the library in a test; the command is not run)

Two panes

A window of two panes.

session_name: 2-pane-vertical
windows:
- window_name: my test window
panes:
- echo hello
- echo hello
{
"session_name": "2-pane-vertical",
"windows": [
{
"window_name": "my test window",
"panes": [
"echo hello",
"echo hello"
]
}
]
}

Converted from the YAML; the tests load the YAML.

0:my test window
Window 0, my test window: 2 panes, even-vertical❯ echo hello❯ echo hello
no layout set

Same file as tmuxp's examples/2-pane-vertical.yaml.

Source: tests/fixtures/workspace/tmuxp-v1.74.0-2-pane-vertical.yaml

Loaded by:

  • tmuxp example catalog: Imports the file with Import-TmuxWorkspace. Starts no tmux. (tests/WorkspaceFiles.Tests.ps1; loaded by the library in a test; the command is not run)

Three panes

A window of three panes.

Also shows: setup before each pane

session_name: 3-panes
windows:
- window_name: dev window
layout: main-vertical
shell_command_before:
- cd ~/
panes:
- shell_command:
- cd /var/log
- ls -al | grep \.log
- echo hello
- echo hello
{
"session_name": "3-panes",
"windows": [
{
"window_name": "dev window",
"layout": "main-vertical",
"shell_command_before": [
"cd ~/"
],
"panes": [
{
"shell_command": [
"cd /var/log",
"ls -al | grep \\.log"
]
},
"echo hello",
"echo hello"
]
}
]
}

Converted from the YAML; the tests load the YAML.

0:dev window
Window 0, dev window: 3 panes, main-vertical❯ cd /var/log❯ ls -al | grep \.log❯ echo hello❯ echo hello
layout main-vertical

Same file as tmuxp's examples/3-pane.yaml.

Source: tests/fixtures/workspace/tmuxp-v1.74.0-3-pane.yaml

Loaded by:

  • tmuxp example catalog: Imports the file with Import-TmuxWorkspace. Starts no tmux. (tests/WorkspaceFiles.Tests.ps1; loaded by the library in a test; the command is not run)

Four panes

A window of four panes.

Also shows: tiled layout

session_name: 4-pane-split
windows:
- window_name: dev window
layout: tiled
shell_command_before:
- cd ~/
panes:
- shell_command:
- cd /var/log
- ls -al | grep \.log
- echo hello
- echo hello
- echo hello
{
"session_name": "4-pane-split",
"windows": [
{
"window_name": "dev window",
"layout": "tiled",
"shell_command_before": [
"cd ~/"
],
"panes": [
{
"shell_command": [
"cd /var/log",
"ls -al | grep \\.log"
]
},
"echo hello",
"echo hello",
"echo hello"
]
}
]
}

Converted from the YAML; the tests load the YAML.

0:dev window
Window 0, dev window: 4 panes, tiled❯ cd /var/log❯ ls -al | grep \.log❯ echo hello❯ echo hello❯ echo hello
layout tiled

Same file as tmuxp's examples/4-pane.yaml.

Source: tests/fixtures/workspace/tmuxp-v1.74.0-4-pane.yaml

Loaded by:

  • tmuxp example catalog: Imports the file with Import-TmuxWorkspace. Starts no tmux. (tests/WorkspaceFiles.Tests.ps1; loaded by the library in a test; the command is not run)

Main-horizontal layout

The main-horizontal layout gives the first pane the top of the window and splits the rest below it.

Also shows: three panes

session_name: test window options
start_directory: '~'
windows:
- layout: main-horizontal
options:
main-pane-height: 5
panes:
- pane
- pane
- pane
window_name: editor
{
"session_name": "test window options",
"start_directory": "~",
"windows": [
{
"layout": "main-horizontal",
"options": {
"main-pane-height": 5
},
"panes": [
"pane",
"pane",
"pane"
],
"window_name": "editor"
}
]
}

Converted from the YAML; the tests load the YAML.

0:editor
Window 0, editor: 3 panes, main-horizontal
layout main-horizontal

Source: tests/fixtures/workspace/tmuxp-v1.74.0-window_options.yaml

Loaded by:

  • window options fixture: Runs the workspace cmdlets Import-TmuxWorkspace, Resolve-TmuxWorkspace, Get-TmuxWorkspacePlan and Invoke-TmuxWorkspace on the file against real tmux and checks the layout, the main-pane-height option and each pane's directory. (tests/WorkspaceCorpus.Tests.ps1; a test runs the command)

Setup before each pane

shell_command_before runs ahead of a pane's own commands, at the session, window or pane level.

Also shows: environment, start directory, two panes

session_name: corpus
start_directory: ${PROJECT_ROOT}
options:
default-command: exec /bin/sh
'@corpus-session': yaml-original
environment:
CORPUS_SESSION: yaml-root
CORPUS_LAYER: session
shell_command_before:
- cmd: echo session >> order.txt
windows:
- window_name: yaml-editor
start_directory: window
layout: even-horizontal
focus: true
options:
'@corpus-window': '${OPTION_TAG}'
environment:
CORPUS_WINDOW: yaml-window
CORPUS_LAYER: window
shell_command_before:
- cmd: echo window >> order.txt
panes:
- shell_command:
- cmd: echo command >> order.txt
- 'echo "$CORPUS_SESSION|$CORPUS_WINDOW|$CORPUS_PANE|$CORPUS_LAYER" > environment.txt'
- tmux wait-for -S corpus-yaml-first
- start_directory: pane
focus: true
options:
'@corpus-pane': yaml
environment:
CORPUS_PANE: yaml-pane
CORPUS_LAYER: pane
shell_command_before:
- cmd: echo pane >> order.txt
shell_command:
- echo command >> order.txt
- 'echo "$CORPUS_SESSION|$CORPUS_WINDOW|$CORPUS_PANE|$CORPUS_LAYER" > environment.txt'
- tmux wait-for -S corpus-yaml-second
{
"session_name": "corpus",
"start_directory": "${PROJECT_ROOT}",
"options": {
"default-command": "exec /bin/sh",
"@corpus-session": "yaml-original"
},
"environment": {
"CORPUS_SESSION": "yaml-root",
"CORPUS_LAYER": "session"
},
"shell_command_before": [
{
"cmd": "echo session >> order.txt"
}
],
"windows": [
{
"window_name": "yaml-editor",
"start_directory": "window",
"layout": "even-horizontal",
"focus": true,
"options": {
"@corpus-window": "${OPTION_TAG}"
},
"environment": {
"CORPUS_WINDOW": "yaml-window",
"CORPUS_LAYER": "window"
},
"shell_command_before": [
{
"cmd": "echo window >> order.txt"
}
],
"panes": [
{
"shell_command": [
{
"cmd": "echo command >> order.txt"
},
"echo \"$CORPUS_SESSION|$CORPUS_WINDOW|$CORPUS_PANE|$CORPUS_LAYER\" > environment.txt",
"tmux wait-for -S corpus-yaml-first"
]
},
{
"start_directory": "pane",
"focus": true,
"options": {
"@corpus-pane": "yaml"
},
"environment": {
"CORPUS_PANE": "yaml-pane",
"CORPUS_LAYER": "pane"
},
"shell_command_before": [
{
"cmd": "echo pane >> order.txt"
}
],
"shell_command": [
"echo command >> order.txt",
"echo \"$CORPUS_SESSION|$CORPUS_WINDOW|$CORPUS_PANE|$CORPUS_LAYER\" > environment.txt",
"tmux wait-for -S corpus-yaml-second"
]
}
]
}
]
}

Converted from the YAML; the tests load the YAML.

0:yaml-editor
Window 0, yaml-editor: 2 panes, even-horizontal❯ echo command >> order.txt❯ echo "$CORPUS_SESSION|$CORPUS_WINDOW|$CORPUS_PANE|$CORPUS_LAYER" > environment.txt❯ tmux wait-for -S corpus-yaml-first❯ echo command >> order.txt❯ echo "$CORPUS_SESSION|$CORPUS_WINDOW|$CORPUS_PANE|$CORPUS_LAYER" > environment.txt❯ tmux wait-for -S corpus-yaml-second
layout even-horizontal

${PROJECT_ROOT} and ${OPTION_TAG} are variables the loader expands.

Source: tests/fixtures/workspace/corpus.yaml

Loaded by:

  • corpus fixture: Runs the workspace cmdlets Import-TmuxWorkspace, Resolve-TmuxWorkspace, Get-TmuxWorkspacePlan and Invoke-TmuxWorkspace on the file against real tmux and checks the order of the commands, the environment each pane sees and each pane's directory. (tests/WorkspaceCorpus.Tests.ps1; a test runs the command)

Environment

environment sets variables for a session, a window or a pane.

session_name: test env vars
start_directory: "~"
environment:
FOO: SESSION
PATH: /tmp
windows:
- window_name: no_overrides
panes:
- pane
- window_name: window_overrides
environment:
FOO: WINDOW
panes:
- pane
- window_name: pane_overrides
panes:
- environment:
FOO: PANE
- window_name: both_overrides
environment:
FOO: WINDOW
panes:
- pane
- environment:
FOO: PANE
# This test case it just needed for warnings issued in old versions of tmux.
- window_name: both_overrides_on_first_pane
environment:
FOO: WINDOW
panes:
- environment:
FOO: PANE
{
"session_name": "test env vars",
"start_directory": "~",
"environment": {
"FOO": "SESSION",
"PATH": "/tmp"
},
"windows": [
{
"window_name": "no_overrides",
"panes": [
"pane"
]
},
{
"window_name": "window_overrides",
"environment": {
"FOO": "WINDOW"
},
"panes": [
"pane"
]
},
{
"window_name": "pane_overrides",
"panes": [
{
"environment": {
"FOO": "PANE"
}
}
]
},
{
"window_name": "both_overrides",
"environment": {
"FOO": "WINDOW"
},
"panes": [
"pane",
{
"environment": {
"FOO": "PANE"
}
}
]
},
{
"window_name": "both_overrides_on_first_pane",
"environment": {
"FOO": "WINDOW"
},
"panes": [
{
"environment": {
"FOO": "PANE"
}
}
]
}
]
}

Converted from the YAML; the tests load the YAML.

0:no_overrides
Window 0, no_overrides: 1 pane, even-vertical
no layout set
1:window_overrides
Window 1, window_overrides: 1 pane, even-vertical
no layout set
2:pane_overrides
Window 2, pane_overrides: 1 pane, even-vertical
no layout set
3:both_overrides
Window 3, both_overrides: 2 panes, even-vertical
no layout set
4:both_overrides_on_first_pane
Window 4, both_overrides_on_first_pane: 1 pane, even-vertical
no layout set

Source: tests/fixtures/workspace/tmuxp-v1.74.0-environment_vars.yaml

Loaded by:

  • environment variables fixture: Runs the workspace cmdlets Import-TmuxWorkspace, Resolve-TmuxWorkspace, Get-TmuxWorkspacePlan and Invoke-TmuxWorkspace on the file against real tmux and checks the session environment and the value each pane prints. (tests/WorkspaceCorpus.Tests.ps1; a test runs the command)

Start directory

start_directory chooses where a session, a window or a pane starts.

Also shows: two panes

session_name: sample workspace
windows:
- panes:
- start_directory: /usr
- start_directory: /etc
{
"session_name": "sample workspace",
"windows": [
{
"panes": [
{
"start_directory": "/usr"
},
{
"start_directory": "/etc"
}
]
}
]
}

Converted from the YAML; the tests load the YAML.

0:window
Window 0: 2 panes, even-vertical
no layout set

Source: tests/fixtures/workspace/tmuxp-v1.74.0-first_pane_start_directory.yaml

Loaded by:

  • first pane start directory fixture: Runs the workspace cmdlets Import-TmuxWorkspace, Get-TmuxWorkspacePlan and Invoke-TmuxWorkspace on the file against real tmux, resolving it with the document's Resolve method, and checks the directory of each pane. (tests/WorkspaceCorpus.Tests.ps1; a test runs the command)

Synchronized panes

options_after sets synchronize-panes once the panes exist, so typing in one pane reaches the others.

session_name: 2-pane-synchronized
windows:
- window_name: Two synchronized panes
panes:
- ssh server1
- ssh server2
options_after:
synchronize-panes: on
{
"session_name": "2-pane-synchronized",
"windows": [
{
"window_name": "Two synchronized panes",
"panes": [
"ssh server1",
"ssh server2"
],
"options_after": {
"synchronize-panes": "on"
}
}
]
}

Converted from the YAML; the tests load the YAML.

0:Two synchronized panes
Window 0, Two synchronized panes: 2 panes, even-vertical❯ ssh server1❯ ssh server2
no layout set

Same file as tmuxp's examples/2-pane-synchronized.yaml.

Source: tests/fixtures/workspace/tmuxp-v1.74.0-2-pane-synchronized.yaml

Loaded by:

  • tmuxp example catalog: Imports the file with Import-TmuxWorkspace. Starts no tmux. (tests/WorkspaceFiles.Tests.ps1; loaded by the library in a test; the command is not run)

Main pane height as a percentage

main-pane-height takes a percentage of the window as well as a row count.

Also shows: three panes, main-horizontal layout, start directory

session_name: main-pane-height
start_directory: "~"
windows:
- layout: main-horizontal
options:
main-pane-height: 67%
panes:
- shell_command:
- top
start_directory: "~"
- shell_command:
- echo "hey"
- shell_command:
- echo "moo"
window_name: my window name
{
"session_name": "main-pane-height",
"start_directory": "~",
"windows": [
{
"layout": "main-horizontal",
"options": {
"main-pane-height": "67%"
},
"panes": [
{
"shell_command": [
"top"
],
"start_directory": "~"
},
{
"shell_command": [
"echo \"hey\""
]
},
{
"shell_command": [
"echo \"moo\""
]
}
],
"window_name": "my window name"
}
]
}

Converted from the YAML; the tests load the YAML.

0:my window name
Window 0, my window name: 3 panes, main-horizontal❯ top❯ echo "hey"❯ echo "moo"
layout main-horizontal

Same file as tmuxp's examples/main-pane-height-percentage.yaml.

Source: tests/fixtures/workspace/tmuxp-v1.74.0-main-pane-height-percentage.yaml

Loaded by:

  • tmuxp example catalog: Imports the file with Import-TmuxWorkspace. Starts no tmux. (tests/WorkspaceFiles.Tests.ps1; loaded by the library in a test; the command is not run)

Minimal workspace

A session name and one window with one blank pane.

session_name: My tmux session
windows:
- panes:
-
{
"session_name": "My tmux session",
"windows": [
{
"panes": [
null
]
}
]
}

Converted from the YAML; the tests load the YAML.

0:window
Window 0: 1 pane, even-vertical
no layout set

Same file as tmuxp's examples/minimal.yaml.

Source: tests/fixtures/workspace/tmuxp-v1.74.0-minimal.yaml

Loaded by:

  • tmuxp example catalog: Imports the file with Import-TmuxWorkspace. Starts no tmux. (tests/WorkspaceFiles.Tests.ps1; loaded by the library in a test; the command is not run)

tmux options

global_options, options and a window's options set tmux options.

Also shows: main-horizontal layout, three panes, start directory

session_name: test window options
start_directory: "~"
global_options:
default-shell: /bin/sh
default-command: /bin/sh
options:
main-pane-height: ${MAIN_PANE_HEIGHT} # works with env variables
windows:
- layout: main-horizontal
options:
automatic-rename: on
panes:
- shell_command:
- man echo
start_directory: "~"
- shell_command:
- echo "hey"
- shell_command:
- echo "moo"
{
"session_name": "test window options",
"start_directory": "~",
"global_options": {
"default-shell": "/bin/sh",
"default-command": "/bin/sh"
},
"options": {
"main-pane-height": "${MAIN_PANE_HEIGHT}"
},
"windows": [
{
"layout": "main-horizontal",
"options": {
"automatic-rename": "on"
},
"panes": [
{
"shell_command": [
"man echo"
],
"start_directory": "~"
},
{
"shell_command": [
"echo \"hey\""
]
},
{
"shell_command": [
"echo \"moo\""
]
}
]
}
]
}

Converted from the YAML; the tests load the YAML.

0:window
Window 0: 3 panes, main-horizontal❯ man echo❯ echo "hey"❯ echo "moo"
layout main-horizontal

Same file as tmuxp's examples/options.yaml.

Source: tests/fixtures/workspace/tmuxp-v1.74.0-options.yaml

Loaded by:

  • tmuxp example catalog: Imports the file with Import-TmuxWorkspace. Starts no tmux. (tests/WorkspaceFiles.Tests.ps1; loaded by the library in a test; the command is not run)

Skip Enter for a command

enter: false types a command without running it.

session_name: Skip command execution (command-level)
windows:
- panes:
- shell_command:
# You can see this
- echo "___$((11 + 1))___"
# This is skipped
- cmd: echo "___$((1 + 3))___"
enter: false
{
"session_name": "Skip command execution (command-level)",
"windows": [
{
"panes": [
{
"shell_command": [
"echo \"___$((11 + 1))___\"",
{
"cmd": "echo \"___$((1 + 3))___\"",
"enter": false
}
]
}
]
}
]
}

Converted from the YAML; the tests load the YAML.

0:window
Window 0: 1 pane, even-vertical❯ echo "___$((11 + 1))___"❯ echo "___$((1 + 3))___"
no layout set

Same file as tmuxp's examples/skip-send.yaml.

Source: tests/fixtures/workspace/tmuxp-v1.74.0-skip-send.yaml

Loaded by:

  • skip-send fixture: Plans the file and its JSON twin with Get-TmuxWorkspacePlan and checks which commands are sent without Enter. Applies nothing. (tests/WorkspaceCorpus.Tests.ps1; built by the library in a test; the command is not run)

Skip Enter for a pane

enter: false on a pane types its commands without running them.

session_name: Skip command execution (pane-level)
windows:
- panes:
- shell_command: echo "___$((1 + 3))___"
enter: false
- shell_command:
- echo "___$((1 + 3))___"\;
- echo "___$((1 + 3))___"
enter: false
{
"session_name": "Skip command execution (pane-level)",
"windows": [
{
"panes": [
{
"shell_command": "echo \"___$((1 + 3))___\"",
"enter": false
},
{
"shell_command": [
"echo \"___$((1 + 3))___\"\\;",
"echo \"___$((1 + 3))___\""
],
"enter": false
}
]
}
]
}

Converted from the YAML; the tests load the YAML.

0:window
Window 0: 2 panes, even-vertical❯ echo "___$((1 + 3))___"❯ echo "___$((1 + 3))___"\;❯ echo "___$((1 + 3))___"
no layout set

Same file as tmuxp's examples/skip-send-pane-level.yaml.

Source: tests/fixtures/workspace/tmuxp-v1.74.0-skip-send-pane-level.yaml

Loaded by:

  • skip-send pane-level fixture: Plans the file and its JSON twin with Get-TmuxWorkspacePlan and checks which commands are sent without Enter. Applies nothing. (tests/WorkspaceCorpus.Tests.ps1; built by the library in a test; the command is not run)

Window index

window_index places a window at an index; a window without one takes the lowest free index.

session_name: Window index example
windows:
- window_name: zero
panes:
- echo "this window's index will be zero"
- window_name: five
panes:
- echo "this window's index will be five"
window_index: 5
- window_name: one
panes:
- echo "this window's index will be one"
{
"session_name": "Window index example",
"windows": [
{
"window_name": "zero",
"panes": [
"echo \"this window's index will be zero\""
]
},
{
"window_name": "five",
"panes": [
"echo \"this window's index will be five\""
],
"window_index": 5
},
{
"window_name": "one",
"panes": [
"echo \"this window's index will be one\""
]
}
]
}

Converted from the YAML; the tests load the YAML.

0:zero
Window 0, zero: 1 pane, even-vertical❯ echo "this window's index will be zero"
no layout set
1:one
Window 1, one: 1 pane, even-vertical❯ echo "this window's index will be one"
no layout set
5:five
Window 5, five: 1 pane, even-vertical❯ echo "this window's index will be five"
no layout set

Same file as tmuxp's examples/window-index.yaml.

Source: tests/fixtures/workspace/tmuxp-v1.74.0-window-index.yaml

Loaded by:

  • tmuxp example catalog: Imports the file with Import-TmuxWorkspace. Starts no tmux. (tests/WorkspaceFiles.Tests.ps1; loaded by the library in a test; the command is not run)
Esc
Search in

Type to search.

Reference previewOpen reference