Session.list_windows
Behavior: Live acquisition.
Source and package
- Qualified name
-
LibTmux:: Session# list _windows - Module
- LibTmux
- Declared in
Session- Package
- libtmux
- Source
- gems/libtmux/lib/libtmux/entity.rb
- Other languages
- Perl Erlangfunction PowerShellcmdlet Juliafunction Elixir Haskell Common Lispfunction Python Lua TypeScriptRustGoJavaC#C++SwiftKotlinScalaOCamlfunction F#function Clojurefunction
-
Description#
Behavior contract: Live acquisition.
Examples#
List all server windows and the windows belonging to one session. Use Ruby 3.3 or newer with Bundler, and tmux 3.3a or newer, on Unix with
/bin/catand/bin/shavailable. In an empty directory, save thisGemfile:source "https://rubygems.org"gem "libtmux", "0.1.2"Save this complete program as
list_windows.rb. ItsServer.startblock owns a private tmux server and stops it on exit, including after an error. View source# frozen_string_literal: truerequire "libtmux"beginLibTmux::Server.start do |server|work = server.new_session(name: "work", command: ["/bin/cat"])work.new_window(name: "logs", command: ["/bin/cat"])server.new_session(name: "other", command: ["/bin/cat"])puts "server windows: #{server.list_windows.length}"puts "work windows: #{work.list_windows.length}"endrescue StandardError => errorwarn "#{error.class}: #{error.message}"exit 1endInstall the gem and run the program. An operation or cleanup error makes it exit unsuccessfully:
Terminal window $ bundle install && \bundle exec ruby list_windows.rbExpected output:
server windows: 3work windows: 2
tmux command#
The tmux commands behind list_windows.
list-windows -t session scope, cmd_list_windows_exec tmux C API#
The C declarations in tmux that implement these commands.
Guides#
Pages that discuss list_windows.
In other ports#
List a session's windows
| Language | Equivalent |
|---|---|
| Python | libtmux |
| PowerShell | Lib Use the -Session parameter set to acquire placements in one session. |
| Julia | Lib windows with a captured SessionSnapshot reads distinct physical windows in that session. Use windowlinks for placements. |
| Erlang | tmux Pass windows, a captured session and its snapshot for a local relationship read. |
| Haskell | No public Haskell equivalent is implemented; the current modules expose scalar values and version parsing. |
| Common Lisp | libtmux: windows traverses a captured session. Repeated links preserve their physical-window multiplicity. |
| TypeScript | session |
| Rust | session |
| Go | tmux |
| Java | io |
| Clojure | libtmux Traverses one capture locally. It does not issue a list-windows command. |
| Kotlin | io |
| Scala | io |
| C# | Lib |
| F# | Lib Builds a deferred window query from one LibTmux.Session and its server. Query.list acquires placements scoped to that session ID. |
| C++ | libtmux:: |
| Swift | Snapshot |
| OCaml | Libtmux Reads distinct captured global windows in this session. window_links preserves individual indexed placements. |
| Perl | Traverse Session::window_links and resolve each link’s window, preserving explicit session placement and multiplicity. |
No equivalent is recorded in Lua or Elixir.