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.
| 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 |
Control and live-view examples require tmux 3.7+ and a carrier-owned pinned socket. Other examples retain the core 3.3a minimum.
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. Each starts its own private
server with Server.start; their consumer build files 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 Scala programs take the tmux executable, socket path and configuration file
as their arguments. The Cats programs run their IO in main.