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-kotlin

Server.windows

Captures every winlink, preserving each session and index placement.

Source and package
Qualified name
io.github.libtmux.kotlin.Server.windows
Package
io.github.libtmux.kotlin
Declared in
Server
Distribution
io.github.libtmux:libtmux-kotlin
Source
libtmux-kotlin/build/generated/sources/operations/kotlin/io/github/libtmux/kotlin/ServerOperations.kt
public Kotlin suspending functionsAllows a function to call suspending operations and pause without blocking a thread. It does not start a coroutine by itself.Language documentation fun Server.windows(): List<Window>public Kotlin suspending functionsAllows a function to call suspending operations and pause without blocking a thread. It does not start a coroutine by itself.Language documentation fun Server.windows( expression: FilterExpr<io.github.libtmux.Window> ): List<Window>public Kotlin suspending functionsAllows a function to call suspending operations and pause without blocking a thread. It does not start a coroutine by itself.Language documentation fun Server.windows(id: WindowId): List< Window >
Parameters

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

Same owner

containment 1 of 51 shown

Other members of io.github.libtmux.kotlin.Server whose names share windows. They sit on the same type; that does not make them behave alike.

All 51 members of Server

Recorded calls

source calls
No call edges in the Kotlin model.

The Kotlin 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.kotlin.Server.windows.

tmux command

task material

The tmux commands behind windows.

tmux C API

task material

The C declarations in tmux that implement these commands.

In other ports

task equivalence 21 other ports mapped

Source-verified mappings for List the server'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 the server's windows in each port
PortAPIDiffers from Kotlin
Kotlin io.github.libtmux.kotlin.Server.windows
Captures every winlink, preserving each session and index placement.
This page
Python libtmux.Server.windows
Windows contained in server's sessions.
None recorded in the model
Ruby LibTmux::Server#list_windows
Behavior: Live acquisition.
None recorded in the model
Lua libtmux.Snapshot.windows None recorded in the model
PowerShell LibTmux\Get-TmuxWindow
Read contextual windows from a server or session.
free function
Use the -Server parameter set to acquire window placements across all sessions.
Julia LibTmux.windows free function
windows with a Snapshot reads every captured physical window. Use windowlinks for session placements.
Erlang tmux_snapshot:windows/1
Return unique captured physical windows in numeric ID order. Performs no I/O. Use window_links/1 for session-relative membership and indexes.
free function
Returns unique captured physical windows. window_links/1 lists session memberships.
Elixir LibTmux.Snapshot.windows/1
Returns a materialized physical window selection without I/O.
on Snapshot
Returns a Selection of every captured physical window. window_links/1 lists session placements.
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.
free function
windows on a snapshot returns captured physical windows once each.
TypeScript server.Server.windows
Every window on the server, including each placement of a linked window.
None recorded in the model
Rust server.Server.windows
List every window on the server, preserving any failure.
None recorded in the model
Go tmux.Server.Windows
Windows materializes one record per winlink. Failures, including ErrNoServer, remain errors rather than empty results.
None recorded in the model
Java io.github.libtmux.Server.windows
Captures every winlink, preserving each session and index placement.
None recorded in the model
Clojure libtmux.core/windows!
Acquires captured window occurrences.
free function
Acquires a new graph and returns its window placements without deduplicating linked windows.
Scala io.github.libtmux.scaladsl.Server.windows
Captures every winlink, preserving each session and index placement.
None recorded in the model
C# LibTmux.Server.Windows
Gets the windows this handle captured, across every session.
None recorded in the model
F# LibTmux.FSharp.Server.windows
Queries window placements across all sessions.
free function
Builds a deferred query for placements across all sessions. Query.list acquires the results; a linked window appears once for each session placement.
C++ libtmux::Server::windows
tmux scopes window and pane listings to the current session unless asked for every one, so -a is part of the request rather than a caller's responsibility to remember.
readonly
Swift Server.windows()
Every window on this server, in tmux's own order.
None recorded in the model
OCaml Libtmux.Snapshot.windows free function
Reads captured global windows; use window_links for indexed session placements.
Perl LibTmux::Snapshot::windows
Return a fresh LibTmux::WindowSelection containing each physical window identity once. Context lives in "window_links".
on Snapshot
One entry per physical identity. window_links retains all session placements.
Raku LibTmux::Model::Snapshot.windows
Captured physical windows, unique by daemon-scoped identity.
on Snapshot
Physical windows occur once; window-links preserves placements.
No Haskell equivalent.

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

Esc
Search in

Type to search.

Reference previewOpen reference