# libtmux:swap-windows

- **Package:** libtmux
- **Language:** Common Lisp
- **Kind:** function
- **Source:** https://github.com/libtmux/libtmux-lisp/blob/c2e5fc4ed3befda21f45dfa5d5868c38fd138311/src/placement.lisp#L75
- **Public owner:** libtmux
- **Page:** https://libtmux.org/en/lisp/latest/reference/libtmux-swap-windows/

```
(swap-windows client first-link second-link &key select (observe t) cancel-token timeout output-limit)
```

Swap physical windows at two captured links; return a COMMAND-OUTCOME.
OBSERVE supplies a fresh vector of replacement links in argument order. SELECT
selects the affected indexes in their sessions; omission keeps current indexes.
Tmux group restrictions apply. Signals STALE-TARGET or an operational condition;
old links retain their original expected window IDs.

## Parameters

- `client`
- `first-link`
- `second-link`
- `select?`
- `observe?`
- `cancel-token?`
- `timeout?`
- `output-limit?`

## tmux command

The tmux commands behind `swap-windows`.

- [`swap-window`](/en/tmux/latest/manual/swap-window/)

## tmux C API

The C declarations in tmux that implement these commands.

- [`cmd_swap_window_entry`](/en/tmux/latest/reference/c-variable-cmd_swap_window_entry/) (attribute)
- [`cmd_swap_window_exec`](/en/tmux/latest/reference/c-function-cmd-swap-window-c-cmd_swap_window_exec/) (function)

## Guides

Pages that discuss `swap-windows`.

- [Explicit operations](/en/lisp/latest/guides/operations/)
