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

Session.windows

This session's windows.

Source and package
Qualified name
io.github.libtmux.scaladsl.Session.windows
Package
io.github.libtmux.scaladsl
Declared in
Session
Distribution
io.github.libtmux:libtmux-scala_3
Source
libtmux-scala/build/generated/sources/catalog/scala/fields/GeneratedFields.scala
Scala method declarationsDeclares a method, with its name, parameter lists and return type.Language documentation windows: _root_.io.github.libtmux.scaladsl.query.Fields.ToManyRef[ JavaSession, JavaWindow ]Scala extension methodsAdds methods callable on the receiver type without changing its definition.Language documentation (self: Session) Scala method declarationsDeclares a method, with its name, parameter lists and return type.Language documentation windows: Vector[Window]

Exported from io.github.libtmux.scaladsl.generated.SessionFields.windows

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

src/main/scala/ListWindows.scalaComplete program
package io.github.libtmux.examples.api.scaladirect
import io.github.libtmux.{SessionSpec, SplitSpec, WindowSpec}
import io.github.libtmux.scaladsl.*
import scala.util.Using
import scala.util.control.NonFatal
/** List all windows, then the windows captured for one session. */
object ListWindows {
def main(args: Array[String]): Unit = {
try {
Using.resource(Server.start()) { server =>
val 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()
)
println("windows=" + server.windows().map(_.name).sorted.mkString(","))
val session =
server.session("work-one").getOrElse(sys.error("missing work-one"))
println(
"session-windows=" + session.windows.map(_.name).sorted.mkString(",")
)
}
} 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.ListWindows && \
build/install/api-example/bin/api-example

Expected output:

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

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.Session.windows.

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 Scala
Scala io.github.libtmux.scaladsl.Session.windows
This session's windows.
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.
free function
Use the -Session parameter set to acquire placements in one session.
Julia LibTmux.windows free function
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.
free function
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.
free function3 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.
free function
Traverses one capture locally. It does not issue a list-windows command.
Kotlin io.github.libtmux.kotlin.Session.windows
This session's windows, in tmux's order. A pure read of the capture.
None recorded in the model
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.
free function
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.
on Snapshot
OCaml Libtmux.Session.windows
Distinct windows in first-link order. All accesses are local.
free function
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