Workspace ManagerconceptHome

Choose documentation 3

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.

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

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

Explore tmux layout / workspace possibilities

Preset
Short-hand panesTwo panesThree panesFour panesMain-horizontal layoutSetup before each paneEnvironmentStart directorySynchronized panesBlank panesVariables in valuesFocusMain pane height as a percentageShell per paneKeep commands out of historyWindow index

Choose a preset 16

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: main-pane-height
start_directory: "~"
windows:
- layout: main-horizontal
options:
main-pane-height: 30
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": 30
},
"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: dev-${PROJECT}
start_directory: ./src
shell_command_before: echo session
environment:
COMMON: session
SESSION: yes-string
windows:
- window_name: api
start_directory: service
shell_command_before: echo window
environment:
COMMON: window
WINDOW: inherited
panes:
- start_directory: ../tools
shell_command_before: echo pane
shell_command:
- echo ${PROJECT}
- cmd: literal
enter: false
- environment:
COMMON: pane
shell_command: echo ${UNKNOWN}
{
"session_name": "dev-${PROJECT}",
"start_directory": "./src",
"shell_command_before": "echo session",
"environment": {
"COMMON": "session",
"SESSION": "yes-string"
},
"windows": [
{
"window_name": "api",
"start_directory": "service",
"shell_command_before": "echo window",
"environment": {
"COMMON": "window",
"WINDOW": "inherited"
},
"panes": [
{
"start_directory": "../tools",
"shell_command_before": "echo pane",
"shell_command": [
"echo ${PROJECT}",
{
"cmd": "literal",
"enter": false
}
]
},
{
"environment": {
"COMMON": "pane"
},
"shell_command": "echo ${UNKNOWN}"
}
]
}
]
}
Window 0, api: 2 panes, even-vertical❯ echo ${PROJECT}❯ literal❯ echo ${UNKNOWN}
no layout set
session_name: Environment variables test
environment:
EDITOR: /usr/bin/vim
DJANGO_SETTINGS_MODULE: my_app.settings.local
SERVER_PORT: "8009"
windows:
- window_name: Django project
panes:
- ./manage.py runserver 0.0.0.0:${SERVER_PORT}
- window_name: Another Django project
environment:
DJANGO_SETTINGS_MODULE: my_app.settings.local
SERVER_PORT: "8010"
panes:
- ./manage.py runserver 0.0.0.0:${SERVER_PORT}
- environment:
DJANGO_SETTINGS_MODULE: my_app.settings.local-testing
SERVER_PORT: "8011"
shell_command: ./manage.py runserver 0.0.0.0:${SERVER_PORT}
{
"session_name": "Environment variables test",
"environment": {
"EDITOR": "/usr/bin/vim",
"DJANGO_SETTINGS_MODULE": "my_app.settings.local",
"SERVER_PORT": "8009"
},
"windows": [
{
"window_name": "Django project",
"panes": [
"./manage.py runserver 0.0.0.0:${SERVER_PORT}"
]
},
{
"window_name": "Another Django project",
"environment": {
"DJANGO_SETTINGS_MODULE": "my_app.settings.local",
"SERVER_PORT": "8010"
},
"panes": [
"./manage.py runserver 0.0.0.0:${SERVER_PORT}",
{
"environment": {
"DJANGO_SETTINGS_MODULE": "my_app.settings.local-testing",
"SERVER_PORT": "8011"
},
"shell_command": "./manage.py runserver 0.0.0.0:${SERVER_PORT}"
}
]
}
]
}
Window 0, Django project: 1 pane, even-vertical❯ ./manage.py runserver 0.0.0.0:${SERVER_PORT}
no layout set
Window 1, Another Django project: 2 panes, even-vertical❯ ./manage.py runserver 0.0.0.0:${SERVER_PORT}❯ ./manage.py runserver 0.0.0.0:${SERVER_PORT}
no layout set
session_name: start directory
start_directory: /var/
windows:
- window_name: should be /var/
panes:
- shell_command:
- echo "\033c
- it trickles down from session-level"
- echo hello
- window_name: should be /var/log
start_directory: log
panes:
- shell_command:
- echo '\033c
- window start_directory concatenates to session start_directory
- if it is not absolute'
- echo hello
- window_name: should be ~
start_directory: "~"
panes:
- shell_command:
- 'echo \\033c ~ has precedence. note: remember to quote ~ in YAML'
- echo hello
- window_name: should be /bin
start_directory: /bin
panes:
- echo '\033c absolute paths also have precedence.'
- echo hello
- window_name: should be workspace file's dir
start_directory: ./
panes:
- shell_command:
- echo '\033c
- ./ is relative to workspace file location
- ../ will be parent of workspace file
- ./test will be \"test\" dir inside dir of workspace file'
- shell_command:
- echo '\033c
- This way you can load up workspaces from projects and maintain
- relative paths.'
{
"session_name": "start directory",
"start_directory": "/var/",
"windows": [
{
"window_name": "should be /var/",
"panes": [
{
"shell_command": [
"echo \"\\033c",
"it trickles down from session-level\""
]
},
"echo hello"
]
},
{
"window_name": "should be /var/log",
"start_directory": "log",
"panes": [
{
"shell_command": [
"echo '\\033c",
"window start_directory concatenates to session start_directory",
"if it is not absolute'"
]
},
"echo hello"
]
},
{
"window_name": "should be ~",
"start_directory": "~",
"panes": [
{
"shell_command": [
"echo \\\\033c ~ has precedence. note: remember to quote ~ in YAML"
]
},
"echo hello"
]
},
{
"window_name": "should be /bin",
"start_directory": "/bin",
"panes": [
"echo '\\033c absolute paths also have precedence.'",
"echo hello"
]
},
{
"window_name": "should be workspace file's dir",
"start_directory": "./",
"panes": [
{
"shell_command": [
"echo '\\033c",
"./ is relative to workspace file location",
"../ will be parent of workspace file",
"./test will be \\\"test\\\" dir inside dir of workspace file'"
]
},
{
"shell_command": [
"echo '\\033c",
"This way you can load up workspaces from projects and maintain",
"relative paths.'"
]
}
]
}
]
}
Window 0, should be /var/: 2 panes, even-vertical❯ echo "\033c❯ it trickles down from session-level"❯ echo hello
no layout set
Window 1, should be /var/log: 2 panes, even-vertical❯ echo '\033c❯ window start_directory concatenates to session start_directory❯ if it is not absolute'❯ echo hello
no layout set
Window 2, should be ~: 2 panes, even-vertical❯ echo \\033c ~ has precedence. note: remember to quote ~ in YAML❯ echo hello
no layout set
Window 3, should be /bin: 2 panes, even-vertical❯ echo '\033c absolute paths also have precedence.'❯ echo hello
no layout set
Window 4, should be workspace file's dir: 2 panes, even-vertical❯ echo '\033c❯ ./ is relative to workspace file location❯ ../ will be parent of workspace file❯ ./test will be \"test\" dir inside dir of workspace file'❯ echo '\033c❯ This way you can load up workspaces from projects and maintain❯ relative paths.'
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: Blank pane test
windows:
# Emptiness will simply open a blank pane, if no shell_command_before.
# All these are equivalent
- window_name: Blank pane test
panes:
-
- pane
- blank
- window_name: More blank panes
panes:
- null
- shell_command:
- shell_command:
-
# an empty string will be treated as a carriage return
- window_name: Empty string (return)
panes:
- ""
- shell_command: ""
- shell_command:
- ""
# a pane can have other options but still be blank
- window_name: Blank with options
panes:
- focus: true
- start_directory: /tmp
{
"session_name": "Blank pane test",
"windows": [
{
"window_name": "Blank pane test",
"panes": [
null,
"pane",
"blank"
]
},
{
"window_name": "More blank panes",
"panes": [
null,
{
"shell_command": null
},
{
"shell_command": [
null
]
}
]
},
{
"window_name": "Empty string (return)",
"panes": [
"",
{
"shell_command": ""
},
{
"shell_command": [
""
]
}
]
},
{
"window_name": "Blank with options",
"panes": [
{
"focus": true
},
{
"start_directory": "/tmp"
}
]
}
]
}
Window 0, Blank pane test: 3 panes, even-vertical
no layout set
Window 1, More blank panes: 3 panes, even-vertical
no layout set
Window 2, Empty string (return): 3 panes, even-vertical
no layout set
Window 3, Blank with options: 2 panes, even-vertical
no layout set
start_directory: "${PWD}/test"
shell_command_before: "echo ${PWD}"
before_script: "${MY_ENV_VAR}/test3.sh"
session_name: session - ${USER} (${MY_ENV_VAR})
windows:
- window_name: editor
panes:
- shell_command:
- tail -F /var/log/syslog
start_directory: /var/log
- window_name: logging for ${USER}
options:
automatic-rename: true
panes:
- shell_command:
- htop
- ls $PWD
{
"start_directory": "${PWD}/test",
"shell_command_before": "echo ${PWD}",
"before_script": "${MY_ENV_VAR}/test3.sh",
"session_name": "session - ${USER} (${MY_ENV_VAR})",
"windows": [
{
"window_name": "editor",
"panes": [
{
"shell_command": [
"tail -F /var/log/syslog"
]
}
],
"start_directory": "/var/log"
},
{
"window_name": "logging for ${USER}",
"options": {
"automatic-rename": true
},
"panes": [
{
"shell_command": [
"htop",
"ls $PWD"
]
}
]
}
]
}
Window 0, editor: 1 pane, even-vertical❯ tail -F /var/log/syslog
no layout set
Window 1, logging for ${USER}: 1 pane, even-vertical❯ htop❯ ls $PWD
no layout set
session_name: focus
windows:
- window_name: attached window
focus: true
panes:
- shell_command:
- echo hello
- echo 'this pane should be selected on load'
focus: true
- shell_command:
- cd /var/log
- echo hello
- window_name: second window
shell_command_before: cd /var/log
panes:
- pane
- shell_command:
- echo 'this pane should be focused, when window switched to first time'
focus: true
- pane
{
"session_name": "focus",
"windows": [
{
"window_name": "attached window",
"focus": true,
"panes": [
{
"shell_command": [
"echo hello",
"echo 'this pane should be selected on load'"
],
"focus": true
},
{
"shell_command": [
"cd /var/log",
"echo hello"
]
}
]
},
{
"window_name": "second window",
"shell_command_before": "cd /var/log",
"panes": [
"pane",
{
"shell_command": [
"echo 'this pane should be focused, when window switched to first time'"
],
"focus": true
},
"pane"
]
}
]
}
Window 0, attached window: 2 panes, even-vertical❯ echo hello❯ echo 'this pane should be selected on load'❯ cd /var/log❯ echo hello
no layout set
Window 1, second window: 3 panes, even-vertical❯ echo 'this pane should be focused, when window switched to first time'
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: Pane shell example
windows:
- window_name: first
window_shell: /usr/bin/python2
layout: even-vertical
suppress_history: false
options:
remain-on-exit: true
panes:
- shell: /usr/bin/python3
shell_command:
- print('This is python 3')
- shell: /usr/bin/vim -u none
shell_command:
- iAll panes have the `remain-on-exit` setting on.
- When you exit out of the shell or application, the panes will remain.
- Use tmux command `:kill-pane` to remove the pane.
- Use tmux command `:respawn-pane` to restart the shell in the pane.
- Use <Escape> and then `:q!` to get out of this vim window. :-)
- shell_command:
- print('Hello World 2')
- shell: /usr/bin/top
{
"session_name": "Pane shell example",
"windows": [
{
"window_name": "first",
"window_shell": "/usr/bin/python2",
"layout": "even-vertical",
"suppress_history": false,
"options": {
"remain-on-exit": true
},
"panes": [
{
"shell": "/usr/bin/python3",
"shell_command": [
"print('This is python 3')"
]
},
{
"shell": "/usr/bin/vim -u none",
"shell_command": [
"iAll panes have the `remain-on-exit` setting on.",
"When you exit out of the shell or application, the panes will remain.",
"Use tmux command `:kill-pane` to remove the pane.",
"Use tmux command `:respawn-pane` to restart the shell in the pane.",
"Use <Escape> and then `:q!` to get out of this vim window. :-)"
]
},
{
"shell_command": [
"print('Hello World 2')"
]
},
{
"shell": "/usr/bin/top"
}
]
}
]
}
Window 0, first: 4 panes, even-vertical❯ print('This is python 3')❯ iAll panes have the `remain-on-exit` setting on.❯ When you exit out of the shell or application, the panes will remain.❯ Use tmux command `:kill-pane` to remove the pane.❯ Use tmux command `:respawn-pane` to restart the shell in the pane.❯ Use <Escape> and then `:q!` to get out of this vim window. :-)❯ print('Hello World 2')
layout even-vertical
session_name: suppress
suppress_history: false
windows:
- window_name: appended
focus: true
suppress_history: false
panes:
- echo "window in the history!"
- window_name: suppressed
suppress_history: true
panes:
- echo "window not in the history!"
- window_name: default
panes:
- echo "session in the history!"
- window_name: mixed
suppress_history: false
panes:
- shell_command:
- echo "command in the history!"
suppress_history: false
- shell_command:
- echo "command not in the history!"
suppress_history: true
- shell_command:
- echo "window in the history!"
{
"session_name": "suppress",
"suppress_history": false,
"windows": [
{
"window_name": "appended",
"focus": true,
"suppress_history": false,
"panes": [
"echo \"window in the history!\""
]
},
{
"window_name": "suppressed",
"suppress_history": true,
"panes": [
"echo \"window not in the history!\""
]
},
{
"window_name": "default",
"panes": [
"echo \"session in the history!\""
]
},
{
"window_name": "mixed",
"suppress_history": false,
"panes": [
{
"shell_command": [
"echo \"command in the history!\""
],
"suppress_history": false
},
{
"shell_command": [
"echo \"command not in the history!\""
],
"suppress_history": true
},
{
"shell_command": [
"echo \"window in the history!\""
]
}
]
}
]
}
Window 0, appended: 1 pane, even-vertical❯ echo "window in the history!"
no layout set
Window 1, suppressed: 1 pane, even-vertical❯ echo "window not in the history!"
no layout set
Window 2, default: 1 pane, even-vertical❯ echo "session in the history!"
no layout set
Window 3, mixed: 3 panes, even-vertical❯ echo "command in the history!"❯ echo "command not in the history!"❯ echo "window in the history!"
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.

Build libtmux-workspace from the source revision in the installation guide. The LibTmuxWorkspace package supplies this command. Follow the workspace guide for its configuration format.

Pkg (Git)
Julia REPL
LibTmuxWorkspace Not on a registry yet
using Pkg
Pkg.activate(".")
repo = "https://github.com/libtmux/libtmux-julia.git"
ref = "0e761d353bc0606f69ad87994958d09a92c7f7d1"
Pkg.add([
    PackageSpec(url=repo, rev=ref),
    PackageSpec(url=repo, rev=ref, subdir="packages/LibTmuxWorkspace"),
])
Then
$ libtmux-workspace load ./workspace.yaml

Run in Julia. Neither package is registered in General, so this installs from Git. Add the core and workspace packages in one call so both use the same revision.

LibTmuxWorkspace reads a tmuxp-style YAML and JSON subset. Validation, expansion and planning do not contact tmux. Applying a plan creates tmux resources and can execute shell input.

Follow the workspace guide to install the package, inspect a plan and run the complete owned-server example. The API reference documents the workspace types and methods.

Example workspaces

Each workspace below is a file that libtmux/libtmux-julia 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: packages/LibTmuxWorkspace/test/fixtures/tmuxp/shorthands.yaml

Loaded by:

  • tmuxp example catalog: Reads and validates the file with read_config and validate. (packages/LibTmuxWorkspace/test/config.jl; 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: packages/LibTmuxWorkspace/test/fixtures/tmuxp/2-pane-vertical.yaml

Loaded by:

  • tmuxp example catalog: Reads and validates the file with read_config and validate. (packages/LibTmuxWorkspace/test/config.jl; 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: packages/LibTmuxWorkspace/test/fixtures/tmuxp/3-pane.yaml

Loaded by:

  • tmuxp example catalog: Reads and validates the file with read_config and validate. (packages/LibTmuxWorkspace/test/config.jl; 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: packages/LibTmuxWorkspace/test/fixtures/tmuxp/4-pane.yaml

Loaded by:

  • tmuxp example catalog: Reads and validates the file with read_config and validate. (packages/LibTmuxWorkspace/test/config.jl; 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: main-pane-height
start_directory: "~"
windows:
- layout: main-horizontal
options:
main-pane-height: 30
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": 30
},
"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.yaml.

Source: packages/LibTmuxWorkspace/test/fixtures/tmuxp/main-pane-height.yaml

Loaded by:

  • tmuxp example catalog: Reads and validates the file with read_config and validate. (packages/LibTmuxWorkspace/test/config.jl; loaded by the library in a test; the command is not run)

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: dev-${PROJECT}
start_directory: ./src
shell_command_before: echo session
environment:
COMMON: session
SESSION: yes-string
windows:
- window_name: api
start_directory: service
shell_command_before: echo window
environment:
COMMON: window
WINDOW: inherited
panes:
- start_directory: ../tools
shell_command_before: echo pane
shell_command:
- echo ${PROJECT}
- cmd: literal
enter: false
- environment:
COMMON: pane
shell_command: echo ${UNKNOWN}
{
"session_name": "dev-${PROJECT}",
"start_directory": "./src",
"shell_command_before": "echo session",
"environment": {
"COMMON": "session",
"SESSION": "yes-string"
},
"windows": [
{
"window_name": "api",
"start_directory": "service",
"shell_command_before": "echo window",
"environment": {
"COMMON": "window",
"WINDOW": "inherited"
},
"panes": [
{
"start_directory": "../tools",
"shell_command_before": "echo pane",
"shell_command": [
"echo ${PROJECT}",
{
"cmd": "literal",
"enter": false
}
]
},
{
"environment": {
"COMMON": "pane"
},
"shell_command": "echo ${UNKNOWN}"
}
]
}
]
}

Converted from the YAML; the tests load the YAML.

0:api
Window 0, api: 2 panes, even-vertical❯ echo ${PROJECT}❯ literal❯ echo ${UNKNOWN}
no layout set

${PROJECT} and ${UNKNOWN} are variables the loader expands. The test sets PROJECT and leaves UNKNOWN literal.

Source: packages/LibTmuxWorkspace/test/config.jl

Loaded by:

  • explicit expansion and inheritance: Parses, validates and expands the document, as the load command does, and checks the resolved directories, commands and environment. (packages/LibTmuxWorkspace/test/config.jl; loaded by the library in a test; the command is not run)

Environment

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

session_name: Environment variables test
environment:
EDITOR: /usr/bin/vim
DJANGO_SETTINGS_MODULE: my_app.settings.local
SERVER_PORT: "8009"
windows:
- window_name: Django project
panes:
- ./manage.py runserver 0.0.0.0:${SERVER_PORT}
- window_name: Another Django project
environment:
DJANGO_SETTINGS_MODULE: my_app.settings.local
SERVER_PORT: "8010"
panes:
- ./manage.py runserver 0.0.0.0:${SERVER_PORT}
- environment:
DJANGO_SETTINGS_MODULE: my_app.settings.local-testing
SERVER_PORT: "8011"
shell_command: ./manage.py runserver 0.0.0.0:${SERVER_PORT}
{
"session_name": "Environment variables test",
"environment": {
"EDITOR": "/usr/bin/vim",
"DJANGO_SETTINGS_MODULE": "my_app.settings.local",
"SERVER_PORT": "8009"
},
"windows": [
{
"window_name": "Django project",
"panes": [
"./manage.py runserver 0.0.0.0:${SERVER_PORT}"
]
},
{
"window_name": "Another Django project",
"environment": {
"DJANGO_SETTINGS_MODULE": "my_app.settings.local",
"SERVER_PORT": "8010"
},
"panes": [
"./manage.py runserver 0.0.0.0:${SERVER_PORT}",
{
"environment": {
"DJANGO_SETTINGS_MODULE": "my_app.settings.local-testing",
"SERVER_PORT": "8011"
},
"shell_command": "./manage.py runserver 0.0.0.0:${SERVER_PORT}"
}
]
}
]
}

Converted from the YAML; the tests load the YAML.

0:Django project
Window 0, Django project: 1 pane, even-vertical❯ ./manage.py runserver 0.0.0.0:${SERVER_PORT}
no layout set
1:Another Django project
Window 1, Another Django project: 2 panes, even-vertical❯ ./manage.py runserver 0.0.0.0:${SERVER_PORT}❯ ./manage.py runserver 0.0.0.0:${SERVER_PORT}
no layout set

Same file as tmuxp's examples/session-environment.yaml.

Source: packages/LibTmuxWorkspace/test/fixtures/tmuxp/session-environment.yaml

Loaded by:

  • tmuxp example catalog: Reads and validates the file with read_config and validate. (packages/LibTmuxWorkspace/test/config.jl; loaded by the library in a test; the command is not run)

Start directory

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

session_name: start directory
start_directory: /var/
windows:
- window_name: should be /var/
panes:
- shell_command:
- echo "\033c
- it trickles down from session-level"
- echo hello
- window_name: should be /var/log
start_directory: log
panes:
- shell_command:
- echo '\033c
- window start_directory concatenates to session start_directory
- if it is not absolute'
- echo hello
- window_name: should be ~
start_directory: "~"
panes:
- shell_command:
- 'echo \\033c ~ has precedence. note: remember to quote ~ in YAML'
- echo hello
- window_name: should be /bin
start_directory: /bin
panes:
- echo '\033c absolute paths also have precedence.'
- echo hello
- window_name: should be workspace file's dir
start_directory: ./
panes:
- shell_command:
- echo '\033c
- ./ is relative to workspace file location
- ../ will be parent of workspace file
- ./test will be \"test\" dir inside dir of workspace file'
- shell_command:
- echo '\033c
- This way you can load up workspaces from projects and maintain
- relative paths.'
{
"session_name": "start directory",
"start_directory": "/var/",
"windows": [
{
"window_name": "should be /var/",
"panes": [
{
"shell_command": [
"echo \"\\033c",
"it trickles down from session-level\""
]
},
"echo hello"
]
},
{
"window_name": "should be /var/log",
"start_directory": "log",
"panes": [
{
"shell_command": [
"echo '\\033c",
"window start_directory concatenates to session start_directory",
"if it is not absolute'"
]
},
"echo hello"
]
},
{
"window_name": "should be ~",
"start_directory": "~",
"panes": [
{
"shell_command": [
"echo \\\\033c ~ has precedence. note: remember to quote ~ in YAML"
]
},
"echo hello"
]
},
{
"window_name": "should be /bin",
"start_directory": "/bin",
"panes": [
"echo '\\033c absolute paths also have precedence.'",
"echo hello"
]
},
{
"window_name": "should be workspace file's dir",
"start_directory": "./",
"panes": [
{
"shell_command": [
"echo '\\033c",
"./ is relative to workspace file location",
"../ will be parent of workspace file",
"./test will be \\\"test\\\" dir inside dir of workspace file'"
]
},
{
"shell_command": [
"echo '\\033c",
"This way you can load up workspaces from projects and maintain",
"relative paths.'"
]
}
]
}
]
}

Converted from the YAML; the tests load the YAML.

0:should be /var/
Window 0, should be /var/: 2 panes, even-vertical❯ echo "\033c❯ it trickles down from session-level"❯ echo hello
no layout set
1:should be /var/log
Window 1, should be /var/log: 2 panes, even-vertical❯ echo '\033c❯ window start_directory concatenates to session start_directory❯ if it is not absolute'❯ echo hello
no layout set
2:should be ~
Window 2, should be ~: 2 panes, even-vertical❯ echo \\033c ~ has precedence. note: remember to quote ~ in YAML❯ echo hello
no layout set
3:should be /bin
Window 3, should be /bin: 2 panes, even-vertical❯ echo '\033c absolute paths also have precedence.'❯ echo hello
no layout set
4:should be workspace file's dir
Window 4, should be workspace file's dir: 2 panes, even-vertical❯ echo '\033c❯ ./ is relative to workspace file location❯ ../ will be parent of workspace file❯ ./test will be \"test\" dir inside dir of workspace file'❯ echo '\033c❯ This way you can load up workspaces from projects and maintain❯ relative paths.'
no layout set

Same file as tmuxp's examples/start-directory.yaml.

Source: packages/LibTmuxWorkspace/test/fixtures/tmuxp/start-directory.yaml

Loaded by:

  • tmuxp example catalog: Reads and validates the file with read_config and validate. (packages/LibTmuxWorkspace/test/config.jl; loaded by the library in a test; the command is not run)

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: packages/LibTmuxWorkspace/test/fixtures/tmuxp/2-pane-synchronized.yaml

Loaded by:

  • tmuxp example catalog: Reads and validates the file with read_config and validate. (packages/LibTmuxWorkspace/test/config.jl; loaded by the library in a test; the command is not run)

Blank panes

An empty entry, null, pane or blank opens a pane with no command.

Also shows: start directory

session_name: Blank pane test
windows:
# Emptiness will simply open a blank pane, if no shell_command_before.
# All these are equivalent
- window_name: Blank pane test
panes:
-
- pane
- blank
- window_name: More blank panes
panes:
- null
- shell_command:
- shell_command:
-
# an empty string will be treated as a carriage return
- window_name: Empty string (return)
panes:
- ""
- shell_command: ""
- shell_command:
- ""
# a pane can have other options but still be blank
- window_name: Blank with options
panes:
- focus: true
- start_directory: /tmp
{
"session_name": "Blank pane test",
"windows": [
{
"window_name": "Blank pane test",
"panes": [
null,
"pane",
"blank"
]
},
{
"window_name": "More blank panes",
"panes": [
null,
{
"shell_command": null
},
{
"shell_command": [
null
]
}
]
},
{
"window_name": "Empty string (return)",
"panes": [
"",
{
"shell_command": ""
},
{
"shell_command": [
""
]
}
]
},
{
"window_name": "Blank with options",
"panes": [
{
"focus": true
},
{
"start_directory": "/tmp"
}
]
}
]
}

Converted from the YAML; the tests load the YAML.

0:Blank pane test
Window 0, Blank pane test: 3 panes, even-vertical
no layout set
1:More blank panes
Window 1, More blank panes: 3 panes, even-vertical
no layout set
2:Empty string (return)
Window 2, Empty string (return): 3 panes, even-vertical
no layout set
3:Blank with options
Window 3, Blank with options: 2 panes, even-vertical
no layout set

Same file as tmuxp's examples/blank-panes.yaml.

Source: packages/LibTmuxWorkspace/test/fixtures/tmuxp/blank-panes.yaml

Loaded by:

  • tmuxp example catalog: Reads and validates the file with read_config and validate. (packages/LibTmuxWorkspace/test/config.jl; loaded by the library in a test; the command is not run)

Variables in values

A ${VAR} in a name, a path or an option expands from the environment of the loading process.

Also shows: start directory

start_directory: "${PWD}/test"
shell_command_before: "echo ${PWD}"
before_script: "${MY_ENV_VAR}/test3.sh"
session_name: session - ${USER} (${MY_ENV_VAR})
windows:
- window_name: editor
panes:
- shell_command:
- tail -F /var/log/syslog
start_directory: /var/log
- window_name: logging for ${USER}
options:
automatic-rename: true
panes:
- shell_command:
- htop
- ls $PWD
{
"start_directory": "${PWD}/test",
"shell_command_before": "echo ${PWD}",
"before_script": "${MY_ENV_VAR}/test3.sh",
"session_name": "session - ${USER} (${MY_ENV_VAR})",
"windows": [
{
"window_name": "editor",
"panes": [
{
"shell_command": [
"tail -F /var/log/syslog"
]
}
],
"start_directory": "/var/log"
},
{
"window_name": "logging for ${USER}",
"options": {
"automatic-rename": true
},
"panes": [
{
"shell_command": [
"htop",
"ls $PWD"
]
}
]
}
]
}

Converted from the YAML; the tests load the YAML.

0:editor
Window 0, editor: 1 pane, even-vertical❯ tail -F /var/log/syslog
no layout set
1:logging for ${USER}
Window 1, logging for ${USER}: 1 pane, even-vertical❯ htop❯ ls $PWD
no layout set

Same file as tmuxp's examples/env-variables.yaml.

Source: packages/LibTmuxWorkspace/test/fixtures/tmuxp/env-variables.yaml

Loaded by:

  • tmuxp example catalog: Reads and validates the file with read_config and validate. (packages/LibTmuxWorkspace/test/config.jl; loaded by the library in a test; the command is not run)

Focus

focus: true selects a window or a pane when the session is built.

Also shows: setup before each pane

session_name: focus
windows:
- window_name: attached window
focus: true
panes:
- shell_command:
- echo hello
- echo 'this pane should be selected on load'
focus: true
- shell_command:
- cd /var/log
- echo hello
- window_name: second window
shell_command_before: cd /var/log
panes:
- pane
- shell_command:
- echo 'this pane should be focused, when window switched to first time'
focus: true
- pane
{
"session_name": "focus",
"windows": [
{
"window_name": "attached window",
"focus": true,
"panes": [
{
"shell_command": [
"echo hello",
"echo 'this pane should be selected on load'"
],
"focus": true
},
{
"shell_command": [
"cd /var/log",
"echo hello"
]
}
]
},
{
"window_name": "second window",
"shell_command_before": "cd /var/log",
"panes": [
"pane",
{
"shell_command": [
"echo 'this pane should be focused, when window switched to first time'"
],
"focus": true
},
"pane"
]
}
]
}

Converted from the YAML; the tests load the YAML.

0:attached window
Window 0, attached window: 2 panes, even-vertical❯ echo hello❯ echo 'this pane should be selected on load'❯ cd /var/log❯ echo hello
no layout set
1:second window
Window 1, second window: 3 panes, even-vertical❯ echo 'this pane should be focused, when window switched to first time'
no layout set

Same file as tmuxp's examples/focus-window-and-panes.yaml.

Source: packages/LibTmuxWorkspace/test/fixtures/tmuxp/focus-window-and-panes.yaml

Loaded by:

  • tmuxp example catalog: Reads and validates the file with read_config and validate. (packages/LibTmuxWorkspace/test/config.jl; 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: packages/LibTmuxWorkspace/test/fixtures/tmuxp/main-pane-height-percentage.yaml

Loaded by:

  • tmuxp example catalog: Reads and validates the file with read_config and validate. (packages/LibTmuxWorkspace/test/config.jl; loaded by the library in a test; the command is not run)

Shell per pane

A pane can start its own shell or program, and window_shell sets the default for a window.

session_name: Pane shell example
windows:
- window_name: first
window_shell: /usr/bin/python2
layout: even-vertical
suppress_history: false
options:
remain-on-exit: true
panes:
- shell: /usr/bin/python3
shell_command:
- print('This is python 3')
- shell: /usr/bin/vim -u none
shell_command:
- iAll panes have the `remain-on-exit` setting on.
- When you exit out of the shell or application, the panes will remain.
- Use tmux command `:kill-pane` to remove the pane.
- Use tmux command `:respawn-pane` to restart the shell in the pane.
- Use <Escape> and then `:q!` to get out of this vim window. :-)
- shell_command:
- print('Hello World 2')
- shell: /usr/bin/top
{
"session_name": "Pane shell example",
"windows": [
{
"window_name": "first",
"window_shell": "/usr/bin/python2",
"layout": "even-vertical",
"suppress_history": false,
"options": {
"remain-on-exit": true
},
"panes": [
{
"shell": "/usr/bin/python3",
"shell_command": [
"print('This is python 3')"
]
},
{
"shell": "/usr/bin/vim -u none",
"shell_command": [
"iAll panes have the `remain-on-exit` setting on.",
"When you exit out of the shell or application, the panes will remain.",
"Use tmux command `:kill-pane` to remove the pane.",
"Use tmux command `:respawn-pane` to restart the shell in the pane.",
"Use <Escape> and then `:q!` to get out of this vim window. :-)"
]
},
{
"shell_command": [
"print('Hello World 2')"
]
},
{
"shell": "/usr/bin/top"
}
]
}
]
}

Converted from the YAML; the tests load the YAML.

0:first
Window 0, first: 4 panes, even-vertical❯ print('This is python 3')❯ iAll panes have the `remain-on-exit` setting on.❯ When you exit out of the shell or application, the panes will remain.❯ Use tmux command `:kill-pane` to remove the pane.❯ Use tmux command `:respawn-pane` to restart the shell in the pane.❯ Use <Escape> and then `:q!` to get out of this vim window. :-)❯ print('Hello World 2')
layout even-vertical

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

Source: packages/LibTmuxWorkspace/test/fixtures/tmuxp/pane-shell.yaml

Loaded by:

  • tmuxp example catalog: Reads and validates the file with read_config and validate. (packages/LibTmuxWorkspace/test/config.jl; loaded by the library in a test; the command is not run)

Keep commands out of history

suppress_history chooses whether commands reach the shell history, per session, window, pane or command.

session_name: suppress
suppress_history: false
windows:
- window_name: appended
focus: true
suppress_history: false
panes:
- echo "window in the history!"
- window_name: suppressed
suppress_history: true
panes:
- echo "window not in the history!"
- window_name: default
panes:
- echo "session in the history!"
- window_name: mixed
suppress_history: false
panes:
- shell_command:
- echo "command in the history!"
suppress_history: false
- shell_command:
- echo "command not in the history!"
suppress_history: true
- shell_command:
- echo "window in the history!"
{
"session_name": "suppress",
"suppress_history": false,
"windows": [
{
"window_name": "appended",
"focus": true,
"suppress_history": false,
"panes": [
"echo \"window in the history!\""
]
},
{
"window_name": "suppressed",
"suppress_history": true,
"panes": [
"echo \"window not in the history!\""
]
},
{
"window_name": "default",
"panes": [
"echo \"session in the history!\""
]
},
{
"window_name": "mixed",
"suppress_history": false,
"panes": [
{
"shell_command": [
"echo \"command in the history!\""
],
"suppress_history": false
},
{
"shell_command": [
"echo \"command not in the history!\""
],
"suppress_history": true
},
{
"shell_command": [
"echo \"window in the history!\""
]
}
]
}
]
}

Converted from the YAML; the tests load the YAML.

0:appended
Window 0, appended: 1 pane, even-vertical❯ echo "window in the history!"
no layout set
1:suppressed
Window 1, suppressed: 1 pane, even-vertical❯ echo "window not in the history!"
no layout set
2:default
Window 2, default: 1 pane, even-vertical❯ echo "session in the history!"
no layout set
3:mixed
Window 3, mixed: 3 panes, even-vertical❯ echo "command in the history!"❯ echo "command not in the history!"❯ echo "window in the history!"
no layout set

Same file as tmuxp's examples/suppress-history.yaml.

Source: packages/LibTmuxWorkspace/test/fixtures/tmuxp/suppress-history.yaml

Loaded by:

  • tmuxp example catalog: Reads and validates the file with read_config and validate. (packages/LibTmuxWorkspace/test/config.jl; loaded 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: packages/LibTmuxWorkspace/test/fixtures/tmuxp/window-index.yaml

Loaded by:

  • tmuxp example catalog: Reads and validates the file with read_config and validate. (packages/LibTmuxWorkspace/test/config.jl; loaded by the library in a test; the command is not run)
Esc
Search in

Type to search.

Reference previewOpen reference