Core Library0.xAPI Reference

Choose documentation 3

v0.1.1

Current version

v0.1.1
English

Early release libtmux is released, and its APIs may still change between releases. This site's structure and URLs may change too.

method libtmux-ruby v0.1.1

Window.list_panes

Behavior: Live acquisition.

Source and package
Qualified name
LibTmux::Window#list_panes
Module
LibTmux
Declared in
Window
Package
libtmux
Source
gems/libtmux/lib/libtmux/entity.rb
Other languages
PowerShellcmdlet Juliafunction Elixir Python Lua TypeScriptRustGoJavaC#C++SwiftKotlinScalaF#function
def list_panes: ( ?timeout: ::Numeric, ?cancel: untyped ) -> ::Array[::LibTmux::Pane]

Description#

Behavior contract: Live acquisition.

Examples#

List panes across the server, within one session, and within one window. Use Ruby 3.3 or newer with Bundler, and tmux 3.3a or newer, on Unix with /bin/cat and /bin/sh available. In an empty directory, save this Gemfile:

source "https://rubygems.org"
gem "libtmux", "0.1.1"

Save this complete program as list_panes.rb. Its Server.start() block owns a private tmux server and stops it on exit, including after an error. View source

# frozen_string_literal: true
require "libtmux"
begin
LibTmux::Server.start do |server|
work = server.new_session(name: "work", command: ["/bin/cat"], receipt: true)
work.pane.split(direction: :horizontal, command: ["/bin/cat"])
server.new_session(name: "other", command: ["/bin/cat"])
puts "server panes: #{server.list_panes.length}"
puts "work panes: #{work.entity.list_panes.length}"
puts "window panes: #{work.window.list_panes.length}"
end
rescue StandardError => error
warn "#{error.class}: #{error.message}"
exit 1
end

Install the gem and run the program. An operation or cleanup error makes it exit unsuccessfully:

Terminal window
$ bundle install && \
bundle exec ruby list_panes.rb

Expected output:

server panes: 3
work panes: 2
window panes: 2
Parameters

tmux command#

The tmux commands behind list_panes.

tmux C API#

The C declarations in tmux that implement these commands.

In other ports#

List a window's panes

Equivalents of List a window's panes in other languages
Language Equivalent
Python libtmux.Window.panes
PowerShell LibTmux\Get-TmuxPane Use the -Window parameter set to acquire panes in one window.
Julia LibTmux.panes panes() with a captured WindowSnapshot reads panes in that window; missing coverage is an error.
TypeScript window.Window.panes
Rust window.Window.panes
Go tmux.Window.Panes
Java io.github.libtmux.Window.panes
Kotlin io.github.libtmux.kotlin.Window.panes
Scala io.github.libtmux.scaladsl.Window.panes
C# LibTmux.Window.Panes
F# LibTmux.FSharp.Window.panes Builds a deferred pane query from one LibTmux.Window and its server. Query.list() acquires panes scoped to that window ID.
C++ libtmux::Window::panes
Swift Snapshot.panes(of:)

No equivalent is recorded in Lua or Elixir.

Esc

Type to search.

Reference previewOpen reference