Core LibraryalphaAPI Reference

Choose documentation 1

latest

Current version

latest
English

Prerelease This site documents an alpha of libtmux. Its structure, URLs and APIs are subject to change.

function libtmux-elixir latest

Session.windows/2

Returns a plain list of captured physical windows in first-link order.

Source and package
Qualified name
LibTmux.Session.windows/2
Module
LibTmux
Declared in
Session
Package
libtmux
Source
lib/libtmux/entities.ex
windows(snapshot, session) @spec windows(LibTmux.Snapshot.t(), t()) :: [ LibTmux.Window.t() ]

Description#

Repeated links to a window contribute it once. For membership indexes use LibTmux.Snapshot.related/4 with :window_links.

The supplied snapshot owns all returned fields and relationships. Only the session's ID and incarnation are used; its other fields may be older. Invalid or stale identities and missing source/relationship coverage raise LibTmux.Error . A covered empty relation returns []. No I/O occurs.

Examples#

iex> alias LibTmux.{Session, Snapshot}
iex> rows = %{session: [%{id: "$0"}], window: [%{id: "@7"}],
...> window_link: [%{session_id: "$0", window_id: "@7", index: 0, active: true},
...> %{session_id: "$0", window_id: "@7", index: 3, active: false}],
...> pane: [%{id: "%9", window_id: "@7"}]}
iex> {:ok, snapshot} = Snapshot.new(rows,
...> server_instance: "example", captured_from: 0, captured_until: 0,
...> complete: [:window_link, :pane],
...> fields: %{window_link: [:session_id, :window_id, :active], pane: [:window_id]})
iex> {:ok, session} = Snapshot.fetch(snapshot, :session, "$0")
iex> [window] = Session.windows(snapshot, session)
iex> window.id
"@7"
iex> Session.panes(snapshot, session) |> Enum.map(& &1.id)
["%9"]
iex> Session.active_window(snapshot, session) == window
true
Parameters

Discussed in Captured tmux state

Esc

Type to search.

Reference preview Open reference