libtmux Reference MCP Search
On this page

session.Session.next_window

View as Markdown

Module
session
Declared in
Session
Package
libtmux
Source
crates/libtmux/src/session.rs
next_window ( self ) Result<Option<Window>, Error>
method [source]
method [source]
next_window

Move to the next window, and return it.

None when there is no next window, which a session holding one window never has. That is an ordinary state rather than a failure, so it is reported as absence; an error means tmux could not be reached or refused the move for some other reason.

Errors

Returns an error when tmux cannot be reached or refuses the move.

Examples

let guard = libtmux::test::TestServer::new().await?;
let session = guard.server().new_session("moving").await?;

// One window, so there is nowhere to go and nothing broke.
assert!(session.next_window().await?.is_none());

session.new_window("second").await?;
assert!(session.next_window().await?.is_some());

guard.shutdown().await?;

0 declared, 0 inherited

Esc

Type to search.