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.from_env

Find the window this process is running in.

Source and package
Qualified name
libtmux::window::Window::from_env
Module
window
Declared in
Window
Package
libtmux
Source
crates/libtmux/src/window.rs
pub async fn from_env(server: &crate::Server) -> Result< Option<Self>, Error >

Description#

Resolved through the pane named by TMUX_PANE, which is the only value tmux gives a process that identifies exactly where it is.

Ok(None) means tmux no longer has that pane.

Errors

Returns an error when TMUX_PANE is absent or is not a pane ID, or when the listing fails.

Examples#

use libtmux::Window;
let session = server.new_session("locating-window").await?;
let pane = session.panes().await?.remove(0);
// Standing in for the environment tmux gives a process it starts.
let found = Window::from_env_value(server, Some(pane.id().as_ref())).await?;
assert_eq!(found.expect("the window exists").id(), pane.window_id());
Parameters

Guides#

Pages that discuss from_env.

Esc

Type to search.

Reference previewOpen reference