# libtmux::Session::select_next_window

- **Module:** libtmux::Session
- **Package:** libtmux-cxx
- **Language:** C++
- **Kind:** method
- **Source:** https://github.com/libtmux/libtmux-cxx/blob/85e8bd603a322dc32bb8b9aeb1a72bcf36945f1d/include/libtmux/entities.hpp#L330
- **Page:** https://libtmux.org/reference/cxx/libtmux-session-select_next_window/

```
libtmux::Session::select_next_window() -> expected< Window, CommandFailure >
```

Move the selection, and answer with the window it landed on.

Named for what they do rather than for what they return: `next_window()` would read as a question, and these change which window is active.

Relative navigation is tmux's to perform, not a caller's to compute. Next and previous wrap around the window list, and "last" means the previously selected window — state only the server holds, which a caller listing windows has no way to reconstruct.

Each fails when there is nowhere to go, as tmux does: a session with one window refuses all three rather than selecting the window already active.
