Server
A tmux server whose operations run in the effect type F.
Source and package
- Qualified name
-
io.github .libtmux .scaladsl .cats. Server - Package
- io.github.libtmux.scaladsl.cats
- Distribution
- io.github.libtmux:libtmux-scala_3
- Source
- libtmux-scala-cats/src/main/scala/io/github/libtmux/scaladsl/cats/Server.scala
-
Description
Acquire it with
Server.resource, or borrow a Java client withServer.fromJava. Releasing theResourcecancels this scope's operations and closes an owned client. Cancellation does not roll back commands already sent to tmux, and closing the client does not stop the tmux server.- Type parameters
-
-
FforServer() [overload 1]
-
Examples
Connect to a private tmux server. Use JDK 25, Gradle 9 or newer, and tmux 3.3a or newer on Linux, with
/bin/catand/bin/shavailable. In an empty directory, save this consumer setup assettings.gradle.kts:rootProject.name = "api-example"Save this consumer setup as
build.gradle.kts. It depends on the 0.1.2 release from Maven Central:plugins {scalaapplication}repositories { mavenCentral() }dependencies {implementation("io.github.libtmux:libtmux-scala-cats_3:0.1.2")implementation("org.scala-lang:scala3-library_3:3.9.0")}java { toolchain { languageVersion.set(JavaLanguageVersion.of(25)) } }application { mainClass.set(providers.gradleProperty("exampleMain")) }Save this consumer setup as
gradle.properties: View sourcegradle.properties org.gradle.jvmargs=-Xmx2g -XX:MaxMetaspaceSize=768m -Dfile.encoding=UTF-8kotlin.daemon.jvmargs=-Xmx2gorg.gradle.workers.max=2Save this complete program as
src/main/scala/Connect.scala. It starts a private tmux server of its own and stops it when the program closes it. View sourcesrc/main/scala/Connect.scalaComplete program package io.github.libtmux.examples.api.scalacatsimport io.github.libtmux.scaladsl.cats.*import _root_.cats.effect.{ExitCode, IO, IOApp}import _root_.cats.syntax.all.*/** Connect to a private tmux server. */object Connect extends IOApp {def run(args: List[String]): IO[ExitCode] = {val program = Server.start[IO]().use { server =>for {alive <- server.isAlive()_ <- IO.println(s"connected=$alive")} yield ()}program.as(ExitCode.Success).handleErrorWith { error =>IO(System.err.println("Example failed: " + error.getMessage)).as(ExitCode.Error)}}}Build the minimal consumer with Gradle and run the saved program. An operation or cleanup error makes the command exit unsuccessfully:
Terminal window $ gradle --console=plain --quiet installDist -PexampleMain=io.github.libtmux.examples.api.scalacats.Connect && \build/install/api-example/bin/api-exampleExpected output:
connected=true
Members48 members
Collections and queries6
- sessions method The sessions this expression matches, 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.
- snapshot method Captures the whole hierarchy in at most four listings, retrying once if the server is replaced.
Common operations5
- newSession method Creates a detached session and returns that exact session.
- killServer method Ends the tmux server and every session on it.
- fromJava method Borrows Java without closing it. The bound covers this facade only; transport capacity and interruption remain the owner's responsibility.
- resource method Owns a Java client, with one to four simultaneous facade calls. Release cancels queued and running operations before closing the client.
- start method Starts a private tmux server and owns it: release ends tmux, removes its directory and fails if the server still answers. As
resourcefor the facade's operation bound and cancellation.
Other members37
- admissionBound method How many tmux commands this server's transport runs at once, from
ServerConfig#maxConcurrentCommands()for a server#opened here. - asJava property The Java client this wraps: the one escape hatch, as on every handle.
- attachedSessions method Captures every session a client is attached to.
- batch method An immutable batch plan; each run dispatches a fresh Java
Batchthrough this server'sExecution. - batchReservingCapacity method Collects a group that may wait for a release through this server's transport.
- captureServer method Captures metadata and entity handles from one observed hierarchy.
- chain method An immutable chain plan using tmux's evolving current target; each run dispatches a fresh Java
CommandChainthrough this server'sExecution. - chainReservingCapacity method Starts an implicit-target chain while reserving transport capacity for its release.
- channel method One of tmux's wait-for channels, named once.
- cmd method Runs one tmux command against this server.
- commands method The commands this tmux knows.
- config method How this server was configured.
- 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.
- globalOptions method The global session options every session inherits unless it sets its own.
- hasSession method Whether a session with this name exists.
- hooks method The global hooks every session inherits.
- identity method Which server this is.
- isAlive method Whether the server is running and answering.
- keys method The server's key bindings:
prefixwhen binding, every table when listing. - killSession method Ends the session with this name, and everything in it.
- lock method Locks every client attached to this server.
- messageLog method The server's message log.
- options method The server-wide options, the ones tmux keeps once per server.
- pane method The one pane this expression matches, captured now, or empty when none does.
- paneFields method Chosen fields for every pane on the server, from one listing.
- prompt method The command prompt's history.
- requireAlive method Requires a running tmux daemon that answers the liveness probe.
- requireCompatibleTmux method Requires a compatible daemon, or a compatible executable when this endpoint is unused.
- run method Runs a command that is expected to work, and raises when it did not.
- session method The one session this expression matches, captured now, or empty when none does.
- shell method Shell commands run by tmux, and tmux commands chosen by a shell exit status.
- sourceFile method Runs a file of tmux commands, as a configuration file would be run.
- toBuilder method A builder holding every configuration and ownership choice this server made.
- variables method Reads only validated tmux variable names, never caller-authored format syntax.
- version method Which tmux this server is running.
- window method The one window link this expression matches, captured now, or empty when none does.
No members of Server match . The filter searches only this type. Search the whole API.
Order: the accessors that walk the hierarchy, the operations the ports share, then the rest.
In other ports
task equivalence 22 other ports mappedSource-verified mappings for A tmux server. A mapping says these APIs perform the same task. It does not say they share defaults, errors or completion: check each page.
| Port | API | Differs from Scala |
|---|---|---|
| Scala | io A tmux server whose operations run in the effect type F. | This page |
| Python | libtmux tmux(1) Server [server_manual]. | None recorded in the model |
| Ruby | Lib Connects to an existing endpoint. Closing retires clients, never the daemon. | None recorded in the model |
| Lua | libtmux | None recorded in the model |
| PowerShell | Lib Construct a tmux endpoint handle without contacting it. | This cmdlet constructs a shared .NET LibTmux.Server handle without contacting tmux. |
| Julia | Lib Describe a tmux endpoint without contacting it. Supply exactly one socket selector. A description does not own a daemon or any sessions. Use from_env to opt into the ambient tmux endpoint. | |
| Erlang | tmux Open tmux endpoints and execute explicit command values. | open/1 observes an existing daemon and starts an endpoint owner. Domain rows remain immutable values. |
| Elixir | Lib An explicit local tmux server descriptor. | Server describes an existing server by executable and socket. It neither connects nor reserves the server’s identity. |
| Haskell | Lib Start, observe and change a tmux daemon through a scoped handle. | LibTmux.Server owns the Server handle. withOwnedServer starts and retires a private daemon; withServer borrows an existing endpoint and releases its own resources afterwards. killServer retires the admitted daemon generation explicitly. Operations such as capture and renameSession are functions of this module that take the handle. |
| Common Lisp | libtmux: A connection scope with one external-operation lease.
Closing cancels owned work and leaves the tmux daemon alive. Captured data may
outlive the client. Public operations never expose its mutable storage. | |
| TypeScript | server One tmux server, addressed by the socket it listens on. | None recorded in the model |
| Rust | server A cloneable handle to one captured tmux server endpoint. | None recorded in the model |
| Go | tmux Server is an immutable handle to one tmux configuration. Its zero value is invalid. Copying a configured Server preserves its configuration and shares its mutex-guarded version cache and checked daemon identity, so a Server and the values derived from it are safe for concurrent method calls (see the package documentation). | None recorded in the model |
| Java | io Manages sessions, windows, and panes on a tmux server. | readonly |
| Clojure | libtmux Opens local resources for an explicit :socket-path or :socket-name endpoint. | Opens a closeable Java server client for an explicit endpoint. Acquisitions return persistent maps with explicit Java references for effects. |
| Kotlin | io Manages sessions, windows, and panes on a tmux server. | None recorded in the model |
| C# | Lib Represents an immutable server handle and snapshot. | None recorded in the model |
| F# | Lib Starts server reads and queries with the caller's cancellation token. | This F# module provides functions over the shared .NET LibTmux.Server type. |
| C++ | libtmux:: One tmux server, addressed by the socket it listens on. | None recorded in the model |
| Swift | Server A tmux server, addressed by its endpoint. | None recorded in the model |
| OCaml | Libtmux An explicit generation-bound connection. Applications retain ownership of the endpoint choice and resource lifetime. | A client is a live, generation-bound server connection. Endpoint describes a socket without connecting; closing a client releases its resources. |
| Perl | Lib Explicit tmux acquisition and commands | Construction records connection settings without tmux I/O. Optional LibTmux::Async::Server returns standard Future results for operations. |
| Raku | Lib | None recorded in the model |