# LibTmux.swap_window

- **Module:** LibTmux
- **Package:** LibTmux
- **Language:** Julia
- **Kind:** function
- **Source:** https://github.com/libtmux/libtmux-julia/blob/f3da513be1225d36d5854cd8db5972c01857578e/src/topology.jl#L222
- **Page:** https://libtmux.org/en/julia/latest/reference/libtmux-swap_window/

```
swap_window(
    connection::LibTmux.ControlConnection,
    first::LibTmux.WindowLinkRef,
    second::LibTmux.WindowLinkRef;
    select,
    kwargs...
)

swap_window(
    server::LibTmux.Server,
    first::LibTmux.WindowLinkRef,
    second::LibTmux.WindowLinkRef;
    select,
    kwargs...
)
```

## Methods

### `swap_window` (overload 1)

```julia
swap_window(
    connection::LibTmux.ControlConnection,
    first::LibTmux.WindowLinkRef,
    second::LibTmux.WindowLinkRef;
    select,
    kwargs...
)
```

[Source](https://github.com/libtmux/libtmux-julia/blob/f3da513be1225d36d5854cd8db5972c01857578e/src/control_topology.jl#L329).

Swap two checked session/index links on the pinned daemon. Other links remain. Membership checks may race concurrent changes; they do not reserve either slot. `select=false` preserves selection where tmux permits. Return `ControlResult`.

```julia
swap_window(connection::ControlConnection, first::WindowLinkRef, second::WindowLinkRef; kwargs...)
```

### `swap_window` (overload 2)

```julia
swap_window(
    server::LibTmux.Server,
    first::LibTmux.WindowLinkRef,
    second::LibTmux.WindowLinkRef;
    select,
    kwargs...
)
```

[Source](https://github.com/libtmux/libtmux-julia/blob/f3da513be1225d36d5854cd8db5972c01857578e/src/topology.jl#L223).

Swap the windows at two explicit links; other links retain their windows.

## Parameters

- `connection` (`LibTmux.ControlConnection`) (for `swap_window(connection, first, second, select, kwargs)`)
- `first` (`LibTmux.WindowLinkRef`)
- `second` (`LibTmux.WindowLinkRef`)
- `select` (`Bool`)
  Default: `false`.
- `kwargs`
- `server` (`LibTmux.Server`) (for `swap_window(server, first, second, select, kwargs)`)
