libtmux Reference MCP Search
On this page

libtmux.Window.swap

View as Markdown

Module
libtmux
Declared in
Window
Package
libtmux
Source
src/libtmux/window.py
swap ( self , target : str | Window , detach : bool | None = None ) None
method [source]
method [source]
swap

Swap this window with another via $ tmux swap-window.

Examples

>>> w1 = session.new_window(window_name='swap_a')
>>> w2 = session.new_window(window_name='swap_b')
>>> w1_idx = w1.window_index
>>> w2_idx = w2.window_index
>>> w1.swap(w2)
>>> w1.window_index == w2_idx
True
>>> w2.window_index == w1_idx
True
Parameters
  • target ( str | Window ) – Target window to swap with. Can be a window ID string or Window.

  • detach ( bool | None ) – Do not change the active window (-d flag).

0 declared, 0 inherited

Esc

Type to search.