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

property libtmux-kotlin

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
public val windows: List<Window>

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/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 {
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 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/kotlin/ListWindows.kt. It starts a private tmux server of its own and stops it when the program closes it. View source

src/main/kotlin/ListWindows.ktComplete program
package io.github.libtmux.examples.api.kotlin
import io.github.libtmux.SplitSpec
import io.github.libtmux.kotlin.*
import io.github.libtmux.kotlin.query.name
import kotlin.system.exitProcess
import 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-example

Expected output:

windows=editor,editor,logs
session-windows=editor,logs

In other ports

task equivalence 18 other ports mapped

Source-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.

List a session's windows in each port
PortAPIDiffers from Kotlin
Kotlin io.github.libtmux.kotlin.Session.windows
This session's windows, in tmux's order. A pure read of the capture.
This page
Python libtmux.Session.windows
Windows contained by session.
None recorded in the model
Ruby LibTmux::Session#list_windows
Behavior: Live acquisition.
None recorded in the model
PowerShell LibTmux\Get-TmuxWindow
Read contextual windows from a server or session.
2 overloads
Use the -Session parameter set to acquire placements in one session.
Julia LibTmux.windows 2 overloads
windows with a captured SessionSnapshot reads distinct physical windows in that session. Use windowlinks for placements.
Erlang tmux_snapshot:related/3
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:windows
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.Session.windows
Windows placed in this session, in listing order.
None recorded in the model
Rust session.Session.windows
List the windows linked into this session, preserving any failure.
async
Go tmux.Session.Windows
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.github.libtmux.Session.windows
This session's windows, in tmux's order. A pure read of the capture.
None recorded in the model
Clojure libtmux.data/windows
Returns the captured window occurrences in a snapshot or session.
Traverses one capture locally. It does not issue a list-windows command.
Scala io.github.libtmux.scaladsl.Session.windows
This session's windows.
2 overloads
C# LibTmux.Session.Windows
Gets the windows the capture found in this session.
None recorded in the model
F# LibTmux.FSharp.Session.windows
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::Session::windows readonly
Swift Snapshot.windows(of:)
The windows of a session, in tmux's order.
None recorded in the model
OCaml Libtmux.Session.windows
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 LibTmux::Model::Session.window-links
Captured session/index associations, including repeated links to one physical window.
Returns captured WindowLink placements. Follow each window relationship for the physical window.
No Haskell equivalent.

No public Haskell equivalent is implemented; the current modules expose scalar values and version parsing.

No Perl equivalent.

Traverse Session::window_links and resolve each link’s window, preserving explicit session placement and multiplicity.

No equivalent is recorded in Lua or Elixir.

Esc
Search in

Type to search.

Reference previewOpen reference