Server.sessions
The sessions this expression matches, captured now.
Source and package
- Qualified name
-
io.github .libtmux .scaladsl .cats .Server. sessions - Package
- io.github.libtmux.scaladsl.cats
- Declared in
Server- Distribution
- io.github.libtmux:libtmux-scala_3
- Source
- libtmux-scala-cats/build/generated/sources/catalog/scala/operations/GeneratedOperations.scala
-
Scala extension methodsAdds methods callable on the receiver type without changing its definition. [F[_]](self: Server[F])(using F: _root_.cats [F] ).effect .Async Scala method declarationsDeclares a method, with its name, parameter lists and return type. sessions( expression: io.github [ io.libtmux .scaladsl .query .Expr .github ] ): F[Vector[Session[F]]].libtmux .Session Scala extension methodsAdds methods callable on the receiver type without changing its definition. [F[_]](self: Server[F])(using F: _root_.cats [F] ).effect .Async Scala method declarationsDeclares a method, with its name, parameter lists and return type. sessions(): F[Vector[Session[F]]] -
- Type parameters
- Parameters
-
-
expression(io.github [io.libtmux .scaladsl .query .Expr .github ]) for.libtmux .Session sessions(expression)
-
Examples
List the sessions returned by a server read. 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/ListSessions.scala. It starts a private tmux server of its own and stops it when the program closes it. View sourcesrc/main/scala/ListSessions.scalaComplete program package io.github.libtmux.examples.api.scalacatsimport io.github.libtmux.{SessionSpec, SplitSpec, WindowSpec}import io.github.libtmux.scaladsl.cats.*import _root_.cats.effect.{ExitCode, IO, IOApp}import _root_.cats.syntax.all.*/** List the sessions returned by a server read. */object ListSessions extends IOApp {def run(args: List[String]): IO[ExitCode] = {val program = Server.start[IO]().use { server =>for {workOne <- server.newSession(SessionSpec.builder().named("work-one").firstWindowNamed("editor").running("/bin/cat").build())_ <- workOne.windows.head.split(SplitSpec.builder().toRight().running("/bin/cat").build())_ <- workOne.newWindow(WindowSpec.builder().named("logs").running("/bin/cat").detached().build())_ <- server.newSession(SessionSpec.builder().named("work-two").firstWindowNamed("editor").running("/bin/cat").build())sessions <- server.sessions()_ <- IO.println("sessions=" + sessions.map(_.name).sorted.mkString(","))} 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.ListSessions && \build/install/api-example/bin/api-exampleExpected output:
sessions=work-one,work-twoSelect sessions with a typed name filter. 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/Query.scala. It starts a private tmux server of its own and stops it when the program closes it. View sourcesrc/main/scala/Query.scalaComplete program package io.github.libtmux.examples.api.scalacatsimport io.github.libtmux.{SessionSpec, SplitSpec, WindowSpec}import io.github.libtmux.scaladsl.cats.*import io.github.libtmux.scaladsl.{Session as SessionFields}import io.github.libtmux.scaladsl.query.*import _root_.cats.effect.{ExitCode, IO, IOApp}import _root_.cats.syntax.all.*/** Select sessions with a typed name filter. */object Query extends IOApp {def run(args: List[String]): IO[ExitCode] = {val program = Server.start[IO]().use { server =>for {workOne <- server.newSession(SessionSpec.builder().named("work-one").firstWindowNamed("editor").running("/bin/cat").build())_ <- workOne.windows.head.split(SplitSpec.builder().toRight().running("/bin/cat").build())_ <- workOne.newWindow(WindowSpec.builder().named("logs").running("/bin/cat").detached().build())_ <- server.newSession(SessionSpec.builder().named("work-two").firstWindowNamed("editor").running("/bin/cat").build())matches <- server.sessions(SessionFields.name.is("work-one"))_ <- IO.println("matches=" + matches.map(_.name).sorted.mkString(","))} 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.Query && \build/install/api-example/bin/api-exampleExpected output:
matches=work-one
Same owner
containment 1 of 48 shownOther members of io.github.libtmux.scaladsl.cats.Server whose names share sessions. They sit on the same type; that does not make them behave alike.
Recorded calls
source callsThe 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.cats.Server.sessions.
tmux command
task materialThe tmux commands behind sessions.
tmux C API
task materialThe C declarations in tmux that implement these commands.
In other ports
task equivalence 21 other ports mappedSource-verified mappings for List the server’s sessions. 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 The sessions this expression matches, captured now. | This page |
| Python | libtmux Sessions contained in server. | None recorded in the model |
| Ruby | Lib Behavior: Live acquisition. | None recorded in the model |
| Lua | libtmux | None recorded in the model |
| PowerShell | Lib Read sessions with optional exact selectors. | free function |
| Julia | Lib | free function |
| Erlang | tmux Return captured sessions in numeric ID order. Performs no I/O and raises incomplete_snapshot when that collection was not captured. | free function Returns captured rows without tmux I/O. |
| Elixir | Lib Returns a materialized session selection without I/O. | on Snapshot Returns a Selection of captured sessions without contacting tmux. |
| Common Lisp | libtmux: Return a fresh vector of physical sessions in captured wire order. No I/O. | free function sessions returns a fresh vector from a captured snapshot without contacting tmux. |
| TypeScript | server Every session on the server, read now. | async |
| Rust | server List every session on the server, preserving any failure. | async |
| Go | tmux Sessions materializes the server's sessions. Failures, including ErrNoServer, remain errors rather than empty results. | None recorded in the model |
| Java | io The sessions this expression matches, captured now. | None recorded in the model |
| Clojure | libtmux Acquires captured sessions; acquisition failure throws. | free function Acquires a new captured graph and returns its session maps; acquisition failure throws. |
| Kotlin | io Every session, captured now. | async |
| C# | Lib Gets the sessions this handle captured. | None recorded in the model |
| F# | Lib Queries every session. | free function Builds a deferred session query on LibTmux.Server. Query.list acquires the results; it does not traverse the handle’s captured membership. |
| C++ | libtmux:: One snapshot each. | readonly |
| Swift | Server Every session on this server, in tmux's own order. | async |
| OCaml | Libtmux | free function Reads an immutable array of already captured sessions without I/O. |
| Perl | Lib Return a fresh LibTmux::SessionSelection in captured order. Empty loaded collections yield empty selections; unloaded collections throw. | on Snapshot Reads captured membership locally, preserving order. |
| Raku | Lib Captured sessions in acquisition order; reading performs no I/O. | on Snapshot |
No public Haskell equivalent is implemented; the current modules expose scalar values and version parsing.