Whole runnable programs. Not published.
The README and the guides carry snippets. These are the other thing: complete
programs with a main, short enough to read in one go and real enough to run.
Every one is executed by this module's own suite against a real tmux, so an example that stopped working fails the build. Examples rot silently otherwise — they are the part of a project nobody compiles and everybody reads first.
| example | shows |
|---|---|
BuildAWorkspace |
making a session, a window, a split, and choosing a layout |
FindPanesRunning |
typed filters over a capture, without asking tmux twice |
WatchPaneOutput |
control mode: reading %output as tmux pushes it |
WatchWhatChanges |
control mode: typed notifications as the server changes |
RunACommand |
running a command to its exit status, not reading the screen |
ServeTmuxOverMcp |
serving this tmux to a model over MCP |
WatchWithFlow |
Kotlin: pushed output as a Flow, and cancelling a wait |
BlockingWorkspace |
Scala: opaque handles, a layout, and the typed field query (exactlyOne) |
CaptureConcurrently |
Scala, Cats: three panes captured at once, each keeping its pane's identity |
ObserveChanges |
Scala, Cats: live state as a Signal, reconciled against a window rename |
ResourceBoundaries |
Scala, Cats: borrowing a Java client, and cancelling one dispatched wait |
WatchWithOx |
Scala, Ox: a live view as a Flow in a supervised fork, watching a window appear |
The common API programs provide separate complete Java, Kotlin, Scala Direct, and Scala Cats examples for construction, listings, creation, queries, and pane input and capture. Their consumer build files and private-server launcher are included alongside the source-owned manifest.
$ ./gradlew :examples:testOr against a tmux server of your own:
$ ./gradlew :examples:compileJava$ java -cp examples/build/classes/java/main:libtmux/build/classes/java/main \
io.github.libtmux.examples.FindPanesRunning /tmp/libtmux-java-dev/demo/s nvimThe suite launches each program's own main in a fresh JVM and checks what it
prints, so what it runs is exactly what you run. A new program without a launch
there fails the build.
The Scala programs take the tmux executable, socket path and configuration file
as their three arguments, and each runs against a fresh server of its own that
must still have its original sessions and clients when the program returns. The
Cats programs run their IO in main: building the value alone does nothing.