- Module
- io.github.libtmux.Server
- Package
- io.github.libtmux:libtmux
- Source
- libtmux/src/main/java/io/github/libtmux/Server.java
- Other languages
- PythonRubyLuaTypeScriptRustGo.NETC++Swift
-
One tmux server, reached over one transport.
Ownership is decided at construction and never inferred.
#opencreates a transport this server closes exactly once;#usingborrows one the caller keeps, so several servers can share a transport and closing one leaves the others working.Closing a server closes a client, not a tmux. It never kills the server process: sessions outlive the program that made them, which is the entire point of tmux.
Close it anyway. A server that owns its transport holds the threads that drain tmux's output, and those are not daemons, so that a reply being read when a program ends is finished rather than truncated. They do let go once they have been idle, so forgetting to close delays a JVM's exit by seconds instead of preventing it — but only closing releases them at once.
Threads. Share one freely. A server holds nothing a call changes, its transport is thread-safe by contract, and the record of what was typed into each pane is concurrent; calls from several threads run side by side, bounded by the transport's own admission. The same goes for every
Session,WindowandPaneit hands out: each is an immutable view of one capture, and a method that changes tmux changes tmux rather than the handle. Close it once, after the last call on any thread.Discussed in Testing with libtmux · Java MCP examples , Java workspace internals , Java workspace builder examples , Java workspace builder API · Architecture , Context managers
In other ports A tmux server
- Python
libtmux.Server - Ruby
LibTmux::Server - Lua
libtmux.Server - TypeScript
server.Server - Rust
server.Server - Go
tmux.Server - .NET
LibTmux.Server - C++
libtmux::Server - Swift
Server
- Python
59 declared, 0 inherited
Members
- sessions method Every session, captured now.
- windows method Captures every winlink, preserving each session and index placement.
- panes method Captures every pane on the server.
- clients method Captures every attached client.
- buffers method The server's paste buffers, which every session shares.
- listCommands method Every command this tmux knows, as it prints them.
- snapshot method Captures the whole hierarchy in at most four listings, retrying once if the server is replaced.
- newSession method Creates a detached session and returns that exact session.
- sourceFile method Runs a file of tmux commands, as a configuration file would be run.
- killServer method Ends the tmux server and every session on it.
- options method The server-wide options, the ones tmux keeps once per server.
- hooks method The global hooks every session inherits.
- isAlive method Whether the server is running and answering.
- runShell method Runs a shell command through tmux, for its effect.
- hasSession method Whether a session with this name exists.
- cmd method Runs one tmux command against this server.
- ifShell method Runs one tmux command or another, according to whether a shell command succeeds.
- promptHistory method What has been typed at tmux's command prompt, oldest first.
- clearPromptHistory method Forgets what has been typed at tmux's command prompt.
- lock method Locks every client attached to this server.
- requireAlive method Requires a running tmux daemon that answers the liveness probe.
- version method Which tmux this server is running.
- messages method The server's own message log, newest last.
- killSession method Ends the session with this name, and everything in it.
- chain method Starts a chain of commands where each one acts on what the last one made.
- attachedSessions method Captures every session a client is attached to.
- globalOptions method The global session options every session inherits unless it sets its own.
- open method A server over a transport it owns and closes.
- channel method One of this server's wait-for channels, which is where a signal is sent and waited for.
- close method Releases an owned transport. Idempotent, and never kills tmux.
- paneFields method Chosen fields for every pane on the server, from one listing.
- within method This server, with every command bounded by a deadline of the caller's choosing.
- awaitChannel method
- batch method Collects several commands to run in one tmux invocation.
- builder method A builder holding the documented defaults.
- Builder class Collects configuration and the ownership choice, then builds a server.
- config method How this server was configured.
- echo method What this library last typed into each of this server's panes.
- environment method The server's environment, which every session inherits and every new process is given.
- expand method Expands a tmux format against the server, and answers with what it came to.
- failed method One sentence for a tmux command that did not succeed.
- failure method
- identity method Which server this is. Every handle taken from it is scoped by this.
- keys method The server's key bindings:
prefixwhen binding, every table when listing. - pane method The pane with this id, captured now.
- refresh method
- requireSameIncarnation method
- requireSameServer method
- run method Runs a command that is expected to work, and raises when it did not.
- runShellCapturing method Runs a shell command through tmux and answers with what it printed.
- runTogether method Runs several commands in one invocation, so nothing of this caller's happens between them.
- serverAbsent method Whether a failed command's stderr says the daemon itself is gone, rather than refusing the request.
- session method The session with this name, captured now.
- setMouseEnabled method Enables or disables mouse handling for sessions on this server.
- toBuilder method A builder holding every configuration and ownership choice this server made.
- using method A server over a transport the caller owns. Closing this server never closes it.
- variables method Reads only validated tmux variable names, never caller-authored format syntax.
- window method The winlink at this exact position, captured now.
- withoutStartingServer method