# window.navigation.Window.linked_sessions_or_empty

- **Module:** window.navigation.Window
- **Package:** libtmux
- **Language:** Rust
- **Kind:** method
- **Source:** https://github.com/libtmux/libtmux-rs/blob/8a648c0894dfffc9303583f753b6c8ae01f2fe76/crates/libtmux/src/window/navigation.rs#L286
- **Page:** https://libtmux.org/reference/rs/window-navigation-window-linked_sessions_or_empty/

```
window.navigation.Window.linked_sessions_or_empty(self) -> Vec<Session>
```

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 named `has,comma`
makes the list `a,has,comma`, which reads exactly like three sessions.

Empty when the listing fails, which suits a status line. Use
[`Self::linked_sessions`] when the difference matters.

## Example

```rust
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?;
```
