Prerelease This site documents an alpha of libtmux. Its structure, URLs and APIs are subject to change.

Java workspace builder examples

Edit this page on GitHub

libtmux-workspace 0.0.1-alpha.12-SNAPSHOT · Source

The module README builds a session with two windows and verifies the returned window and pane counts. The port’s docs-tests project collects Java README fences and runs them against real tmux.

Build a described layoutLink to section

Within an application that already has a Server, import Workspace and WorkspaceBuilder from io.github.libtmux.workspace, and Session from io.github.libtmux. This excerpt uses the same configuration as the module’s result example:

Workspace workspace = WorkspaceBuilder.parse("""
session_name: built
windows:
- window_name: editor
layout: even-horizontal
panes:
- shell_command: echo one
- shell_command: echo two
- window_name: server
panes:
- echo three
""");
Session session = WorkspaceBuilder.build(server, workspace);
System.out.println(session.windows().size());
System.out.println(session.windows().get(0).panes().size());

The output is two windows and two panes in the first window. Use the guide for the complete server setup and cleanup. The builder creates a new session, so the requested name must be available.

VerificationLink to section

From a prepared source checkout, run the documentation example project:

Terminal window
$ ./gradlew :docs-tests:test

The module README also exercises invalid layouts and creating a workspace beside an existing unrelated session. Those checks cover configuration behavior; they do not prove that arbitrary commands launched in a pane have finished or become ready.

Collected README examples

Esc

Type to search.