libtmux Reference MCP Search
On this page

window.Window.select

View as Markdown

Module
window
Declared in
Window
Package
libtmux
Source
crates/libtmux/src/window.rs
Other languages
PythonTypeScriptGoJava.NETC++Swift
select ( mut ) Result<&mut Self, Error>
method [source]
method [source]
select

Make this window active in the session it was reached through.

Targeted by id rather than by index. An index is a slot, not an identity: anything that renumbers windows -- breaking a lone pane out of one moves it to a free index -- leaves a handle's cached index pointing at whatever occupies that slot now, which is a different live window rather than nothing. tmux answers such a target without complaint, so an index-scoped select would switch to the wrong window and report success.

Errors

Returns an error when tmux refuses the command, and Error::ObjectGone when the window is no longer on the server.

In other languages Make a window active

Examples

>>> window = session.active_window
>>> new_window = session.new_window()
>>> session.refresh()
>>> active_windows = [w for w in session.windows if w.window_active == '1']
>>> new_window.window_active == '1'
False
>>> new_window.select()
Window(...)
>>> new_window.window_active == '1'
True
await window.select();

0 declared, 0 inherited

Esc

Type to search.