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

session.Session.search_windows

Rust

View as Markdown

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

The windows under this session 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 session's windows 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?;
session.new_window("build").await?;
let fields = libtmux::Window::filter_fields();
let found = session.search_windows(&fields.window_name.eq("build")).await?;
assert_eq!(found.len(), 1);
guard.shutdown().await?;
>>> _ = session.new_window(window_name='gap7s_target')
>>> _ = session.new_window(window_name='other_window')
>>> matches = session.search_windows(filter='#{m:gap7s_*,#{window_name}}')
>>> [w.window_name for w in matches]
['gap7s_target']

0 declared, 0 inherited

Esc

Type to search.