# LibTmux.Window.panes/2

- **Module:** LibTmux
- **Package:** libtmux
- **Language:** Elixir
- **Kind:** function
- **Source:** https://github.com/libtmux/libtmux-elixir/blob/5bacf40788b43a5af27bb3656e727a921ba2db40/lib/libtmux/entities.ex#L292
- **Page:** https://libtmux.org/en/elixir/pr-173/reference/libtmux-window-panes-2/

```
panes(snapshot, window)
@spec panes(LibTmux.Snapshot.t(), t()) ::
        LibTmux.Selection.t(LibTmux.Pane.t())
```

Returns a selection of captured physical panes in numeric pane-ID order.

Uses the supplied snapshot and validates the window's ID and incarnation.
Identity, coverage, empty-selection and no-I/O behavior follow
`LibTmux.Session.windows/2`.

## Parameters

- `snapshot` (`LibTmux.Snapshot.t()`)
- `window` (`t()`)

## Examples

```elixir
iex> alias LibTmux.{Selection, Snapshot, Window}
iex> rows = %{window: [%{id: "@0"}], pane: [
...>   %{id: "%10", window_id: "@0"}, %{id: "%2", window_id: "@0"}]}
iex> {:ok, snapshot} = Snapshot.new(rows,
...>   server_instance: "example", captured_from: 0, captured_until: 0,
...>   complete: [:pane], fields: %{pane: [:id, :window_id]})
iex> {:ok, window} = Snapshot.fetch(snapshot, :window, "@0")
iex> Window.panes(snapshot, window) |> Enum.map(& &1.id)
["%2", "%10"]
iex> {:ok, pane} = Window.panes(snapshot, window)
...> |> Selection.where(id: "%2") |> Selection.one()
iex> pane.id
"%2"
```

## Guides

Pages that discuss `panes/2`.

- [Captured tmux state](/en/elixir/pr-173/concepts/observations/)
