Session.windows
This session's windows, in tmux's order. A pure read of the capture.
Source and package
- Qualified name
-
io.github .libtmux .kotlin .Session. windows - Package
- io.github.libtmux.kotlin
- Declared in
Session- Distribution
- io.github.libtmux:libtmux-kotlin
- Source
- libtmux-kotlin/src/main/kotlin/io/github/libtmux/kotlin/Session.kt
-
Examples
List all windows, then the windows captured for one session. 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 {kotlin("jvm") version "2.4.10"application}repositories { mavenCentral() }dependencies {implementation("io.github.libtmux:libtmux-kotlin:0.1.2")}java { toolchain { languageVersion.set(JavaLanguageVersion.of(25)) } }kotlin { jvmToolchain(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/kotlin/ListWindows.kt. It starts a private tmux server of its own and stops it when the program closes it. View sourcesrc/main/kotlin/ListWindows.ktComplete program package io.github.libtmux.examples.api.kotlinimport io.github.libtmux.SplitSpecimport io.github.libtmux.kotlin.*import io.github.libtmux.kotlin.query.nameimport kotlin.system.exitProcessimport kotlinx.coroutines.runBlocking/** List all windows, then the windows captured for one session. */fun main() {try {runBlocking {withPrivateServer { server ->val workOne = server.newSession {name = "work-one"window { name = "editor"; running("/bin/cat") }window { name = "logs"; running("/bin/cat") }}workOne.windows.first().split(SplitSpec.builder().toRight().running("/bin/cat").build())server.newSession {name = "work-two"window { name = "editor"; running("/bin/cat") }}println("windows=" + server.windows().map { it.name }.sorted().joinToString(","))val session = server.session(Session.name eq "work-one")println("session-windows=" + session.windows.map { it.name }.sorted().joinToString(","))}}} catch (error: Exception) {if (error is InterruptedException) Thread.currentThread().interrupt()System.err.println("Example failed: ${error.message}")exitProcess(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.kotlin.ListWindowsKt && \build/install/api-example/bin/api-exampleExpected output:
windows=editor,editor,logssession-windows=editor,logs
In other ports
task equivalence 18 other ports mappedSource-verified mappings for List a session's windows. 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 Kotlin |
|---|---|---|
| Kotlin | io This session's windows, in tmux's order. A pure read of the capture. | This page |
| Python | libtmux Windows contained by session. | None recorded in the model |
| Ruby | Lib Behavior: Live acquisition. | None recorded in the model |
| PowerShell | Lib Read contextual windows from a server or session. | 2 overloads Use the -Session parameter set to acquire placements in one session. |
| Julia | Lib | 2 overloads windows with a captured SessionSnapshot reads distinct physical windows in that session. Use windowlinks for placements. |
| Erlang | tmux Traverse a complete captured relationship without I/O. To-many relations return lists; to-one relations return a row or known absence. The input row must belong to this snapshot. Unloaded relations and mismatched rows return tagged errors. | Pass windows, a captured session and its snapshot for a local relationship read. |
| Common Lisp | libtmux: Return a fresh vector of captured windows, without I/O.
Snapshot windows are physical entities in first-occurrence order. Session
windows contain one item per link and preserve repeated physical windows. | 3 overloads windows traverses a captured session. Repeated links preserve their physical-window multiplicity. |
| TypeScript | session Windows placed in this session, in listing order. | None recorded in the model |
| Rust | session List the windows linked into this session, preserving any failure. | async |
| Go | tmux Windows returns newly allocated shallow copies of this snapshot record's winlink views, and reports whether the receiver carries relations at all. | None recorded in the model |
| Java | io This session's windows, in tmux's order. A pure read of the capture. | None recorded in the model |
| Clojure | libtmux Returns the captured window occurrences in a snapshot or session. | Traverses one capture locally. It does not issue a list-windows command. |
| Scala | io This session's windows. | 2 overloads |
| C# | Lib Gets the windows the capture found in this session. | None recorded in the model |
| F# | Lib Queries the window placements in a session. | Builds a deferred window query from one LibTmux.Session and its server. Query.list acquires placements scoped to that session ID. |
| C++ | libtmux:: | readonly |
| Swift | Snapshot The windows of a session, in tmux's order. | None recorded in the model |
| OCaml | Libtmux Distinct windows in first-link order. All accesses are local. | Reads distinct captured global windows in this session. window_links preserves individual indexed placements. |
| Raku | Lib Captured session/index associations, including repeated links to one physical window. | Returns captured WindowLink placements. Follow each window relationship for the physical window. |
No public Haskell equivalent is implemented; the current modules expose scalar values and version parsing.
Traverse Session::window_links and resolve each link’s window, preserving explicit session placement and multiplicity.
No equivalent is recorded in Lua or Elixir.