# LibTmux::Window#list_panes

- **Module:** LibTmux
- **Package:** libtmux
- **Language:** Ruby
- **Kind:** method
- **Source:** https://github.com/libtmux/libtmux-ruby/blob/dcc9f8b5a6970144a9e7d80cd5f381d8f6198372/gems/libtmux/lib/libtmux/entity.rb#L122
- **Page:** https://libtmux.org/en/ruby/v0.1.0.alpha.2/reference/libtmux-window-list_panes/

tmux command: [`list-panes`](/en/tmux/latest/manual/list-panes/)

```
def list_panes: (
  ?timeout: ::Numeric,
  ?cancel: untyped
) -> ::Array[::LibTmux::Pane]
```

Behavior: Live acquisition.

Behavior contract: Live acquisition.

## Examples

List panes across the server, within one session, and within one window. Use Ruby 4.0.7, Bundler, Git and tmux 3.2a or newer on Unix, with /bin/cat and /bin/sh available. In an empty directory, fetch the documented library revision:

```console
$ git clone https://github.com/libtmux/libtmux-ruby.git libtmux-source && \
  git -C libtmux-source checkout dcc9f8b5a6970144a9e7d80cd5f381d8f6198372
```

Save this dependency file as Gemfile:

```ruby
source "https://rubygems.org"

gem "libtmux", path: "libtmux-source/gems/libtmux"
```

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.

[Source example](https://github.com/libtmux/libtmux-ruby/blob/dcc9f8b5a6970144a9e7d80cd5f381d8f6198372/examples/api/list_panes.rb).

```ruby
# 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 runtime dependencies and run the saved program. An operation or cleanup error makes it exit unsuccessfully:

```console
$ bundle config set --local path vendor/bundle && \
  bundle install --jobs 2 && \
  bundle exec ruby list_panes.rb
```

Expected output:

```text
server panes: 3
work panes: 2
window panes: 2
```

## In other ports

### List a window's panes

- PowerShell: [`LibTmux\Get-TmuxPane`](/en/powershell/latest/reference/libtmux-get-tmuxpane/) (cmdlet). Use the [`-Window`](/en/powershell/latest/reference/libtmux-get-tmuxpane/#LibTmux%5CGet-TmuxPane.parameter.Window) parameter set to acquire panes in one window.
- Julia: [`LibTmux.panes`](/en/julia/latest/reference/libtmux-panes/) (function). `panes` with a captured `WindowSnapshot` reads panes in that window; missing coverage is an error.
- Python: [`libtmux.Window.panes`](/en/py/latest/reference/libtmux-window-panes/) (property)
- TypeScript: [`window.Window.panes`](/en/ts/latest/reference/window-window-panes/) (method)
- Rust: [`window.Window.panes`](/en/rs/latest/reference/window-window-panes/) (method)
- Go: [`tmux.Window.Panes`](/en/go/latest/reference/tmux-window-panes/) (method)
- Java: [`io.github.libtmux.Window.Window.panes`](/en/java/latest/reference/io-github-libtmux-window-window-panes/) (method)
- C#: [`LibTmux.Window.Panes`](/en/csharp/latest/reference/libtmux-window-panes/) (property)
- C++: [`libtmux::Window::panes`](/en/cxx/latest/reference/libtmux-window-panes/) (method)
- Swift: [`Snapshot.panes(of:)`](/en/swift/latest/reference/snapshot-panes(of-)/) (method)
- Kotlin: [`io.github.libtmux.kotlin.Window.panes`](/en/kotlin/latest/reference/io-github-libtmux-kotlin-window-panes/) (property)
- Scala: [`io.github.libtmux.scaladsl.Window.panes`](/en/scala/latest/reference/io-github-libtmux-scaladsl-window-panes/) (method)
- F#: [`LibTmux.FSharp.Window.panes`](/en/fsharp/latest/reference/libtmux-fsharp-window-panes/) (function). Builds a deferred pane query from one `LibTmux.Window` and its server. `Query.list` acquires panes scoped to that window ID.
