libtmux Reference MCP Search

Java and Kotlin

Java

Drive a real tmux from Java and Kotlin.

io.github.libtmux:libtmux

Install

$ implementation("io.github.libtmux:libtmux:VERSION")

Quickstart

ServerConfig config = ServerConfig.builder()
.endpoint(ServerEndpoint.socketPath(socket))
.build();
try (Server server = Server.open(config)) {
Session session = server.newSession("demo");
Window window = session.newWindow("build");
Pane pane = window.split();
pane.sendLine("echo hello from libtmux");
}

socket in the code above is a java.nio.file.Path to a real tmux socket — the README's own test fixture supplies one. TmuxEnvironment.current() resolves the socket your own process is already inside, when there is one.

The README's opening example, verbatim — checked by docs-tests, which compiles every README snippet and runs it against a real tmux unless the snippet's own <!-- snippet: compile-only: ... --> marker says why not. This one is marked compile-only: it opens a second client to the suite's own server, which would race it.

API References

Read on

Esc

Type to search.