Core Library0.xAPI Reference

Choose documentation 3

latest

Current version

latest
English

Early release libtmux is released, and its APIs may still change between releases. This site's structure and URLs may change too.

method libtmux-rs latest

Window.get

Read one field of this window's snapshot, named by the handle that filters it.

Source and package
Qualified name
libtmux::window::Window::get
Module
window
Declared in
Window
Package
libtmux
Source
crates/libtmux/src/window.rs
#[cfg(feature = "query")] impl Window #[must_use] pub fn get<F: ReadField<Self>>( &self, field: F ) -> Availability<F::Value<'_>>

Description#

Every field in WindowFields reads this way, including those with no getter of their own. Nothing is sent to tmux, so the value is as old as the snapshot. The result says why a field holds no value: see Availability.

Examples#

use libtmux::query::Filterable as _;
use libtmux::{Availability, Window};
let guard = libtmux::test::TestServer::new().await?;
let session = guard.server().new_session("read").await?;
let window = session.active_window().await?.expect("a session has a window");
let fields = Window::filter_fields();
// The layout as shown, which only differs from the layout while zoomed.
assert_eq!(
window.get(fields.window_visible_layout),
Availability::Available(window.layout()),
);
assert_eq!(window.get(fields.window_id), Availability::Available(window.id()));
guard.shutdown().await?;
Type parameters
Parameters
Esc

Type to search.

Reference previewOpen reference