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

window.Window.search_panes

Rust

View as Markdown

Module
window
Declared in
Window
Package
libtmux
Source
crates/libtmux/src/window/navigation.rs
Other languages
Python TypeScript Go Java .NET C++ Swift
search_panes ( self , matcher : M ) → Result<Vec<Pane>, Error>
method [source]
method [source]
search_panes

The panes under this window that a matcher accepts, reporting why if the listing fails.

Errors

Returns an error when tmux cannot be reached or refuses the listing.

Discussed in Filtering and queries

In other ports Filter a window's panes with a tmux expression

Examples

use libtmux::query::Filterable as _;
let guard = libtmux::test::TestServer::new().await?;
let session = guard.server().new_session("searched").await?;
let window = session.active_window().await?.expect("a window");
let fields = libtmux::Pane::filter_fields();
let found = window.search_panes(&fields.pane_active.eq(true)).await?;
assert_eq!(found.len(), 1);
guard.shutdown().await?;
>>> target_pane = window.split()
>>> matches = window.search_panes(
... filter=f'#{{m:{target_pane.pane_id},#{{pane_id}}}}'
... )
>>> [p.pane_id for p in matches] == [target_pane.pane_id]
True

0 declared, 0 inherited

Esc

Type to search.