Core Library0.xAPI reference

Choose documentation 1

latest

Current version

latest
English

Early release libtmux is released, and its APIs may still change between releases. This site's structure and URLs may change too.

MoreLess about this notice

method libtmux-scala

Server.open

Opens an owned client for config.

Source and package
Qualified name
io.github.libtmux.scaladsl.Server.open
Package
io.github.libtmux.scaladsl
Declared in
Server
Distribution
io.github.libtmux:libtmux-scala_3
Source
libtmux-scala/src/main/scala/io/github/libtmux/scaladsl/Server.scala
Scala method declarationsDeclares a method, with its name, parameter lists and return type.Language documentation open(config: ServerConfig): Server
Parameters

Examples

Connect to a private tmux server. Use JDK 25, Gradle 9 or newer, and tmux 3.3a or newer on Linux, with /bin/cat and /bin/sh available. In an empty directory, save this consumer setup as settings.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 {
scala
application
}
repositories { mavenCentral() }
dependencies {
implementation("io.github.libtmux:libtmux-scala_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 source

gradle.properties
org.gradle.jvmargs=-Xmx2g -XX:MaxMetaspaceSize=768m -Dfile.encoding=UTF-8
kotlin.daemon.jvmargs=-Xmx2g
org.gradle.workers.max=2

Save 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 source

src/main/scala/Connect.scalaComplete program
package io.github.libtmux.examples.api.scaladirect
import io.github.libtmux.scaladsl.*
import scala.util.Using
import scala.util.control.NonFatal
/** Connect to a private tmux server. */
object Connect {
def main(args: Array[String]): Unit = {
try {
Using.resource(Server.start()) { server =>
println(s"connected=${server.isAlive()}")
}
} catch {
case NonFatal(error) =>
System.err.println("Example failed: " + error.getMessage)
sys.exit(1)
}
}
}

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.scaladirect.Connect && \
build/install/api-example/bin/api-example

Expected output:

connected=true

Recorded calls

source calls
No call edges in the Scala model.

The Scala reference records declarations, not calls, so this page shows no callers or callees. That is a limit of the extracted data, not a statement that nothing calls io.github.libtmux.scaladsl.Server.open.

Guides

task material

Pages that discuss open.

Guides
Esc
Search in

Type to search.

Reference previewOpen reference