Examples
Attach and send keys
Find a session, send a command, and read its output.
Capture pane output
Read a pane's screen and wait for output to appear.
Build a workspace from a file
Create a session, windows, and panes from configuration.
Use these programs to send input, capture output, and build a workspace. Each example page includes its source and test coverage. Check those details before adapting an excerpt into a standalone program.
Source and verification¶
Port repositories use the following checks for their source examples. This site reads or copies those examples; a successful site build alone does not execute them:
The test configuration includes README.md and src/libtmux/ in its
doctest collection. The >>> examples run against isolated tmux sessions.
See Testing with libtmux for the fixture each of those test suites runs against, and each example page for the exact file a given snippet was quoted from.