On this page
window.navigation.Window.linked_sessions_or_empty
- Module
- window.navigation
- Declared in
- Window
- Package
- libtmux
- Source
- crates/libtmux/src/window/navigation.rs
-
The sessions this window is linked into, in the order tmux lists them.
A window can be linked into several sessions at once, and every one of them holds the same window rather than a copy. This reports the sessions reaching it, including the one this handle was found through.
The sessions are read from tmux's winlink rows rather than from
#{window_linked_sessions_list}, which is a comma-separated list of *names* and so cannot be taken apart: a session namedhas,commamakes the lista,has,comma, which reads exactly like three sessions.Empty when the listing fails, which suits a status line. Use
Self::linked_sessionswhen the difference matters.Examples
let guard = libtmux::test::TestServer::new().await?; let server = guard.server(); let first = server.new_session("first").await?; let second = server.new_session("second").await?; let window = first.active_window().await?.expect("a window"); assert_eq!(window.linked_sessions_or_empty().await.len(), 1); window.link_to(&second, None).await?; let linked = window.linked_sessions_or_empty().await; assert_eq!(linked.len(), 2, "the same window, reached two ways"); guard.shutdown().await?;
0 declared, 0 inherited