Prerelease This site documents an alpha of libtmux. Its structure, URLs and APIs are subject to change.

session.Session.next_window

View as Markdown

Module
session
Declared in
Session
Package
libtmux
Source
crates/libtmux/src/session.rs
Other languages
Python TypeScript GoJava.NETC++Swift
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.

In other ports Move to the next window of a session

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?;
>>> w = session.new_window(window_name='nw_test')
>>> session.next_window()
Window(...)

0 declared, 0 inherited

Esc

Type to search.