# window.Window.swapWith

- **Module:** window
- **Package:** libtmux
- **Language:** TypeScript
- **Kind:** method
- **Source:** https://github.com/libtmux/libtmux-ts/blob/073b9d7dedad900bff6f5ec0ea47794e40225870/packages/libtmux/src/window.ts#L482
- **Page:** https://libtmux.org/en/ts/latest/reference/window-window-swapwith/

```
swapWith(other: Window): Promise<void>
```

Exchange positions with another window.

## Examples

```ts
await window.swapWith(other);
```

## Parameters

- `other` (`Window`)

## tmux command

The tmux commands behind `swapWith`.

- [`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)

## In other ports

Exchange two windows

| Language | Equivalent |
| --- | --- |
| Python | [`libtmux.Window.swap`](/en/py/latest/reference/libtmux-window-swap/) (method) |
| Lua | [`libtmux.WindowLink:swap`](/en/lua/latest/reference/libtmux-windowlink-swap/) (method) |
| Rust | [`window.Window.swap_with`](/en/rs/latest/reference/window-window-swap_with/) (method) |
| Go | [`tmux.Window.Swap`](/en/go/latest/reference/tmux-window-swap/) (method) |
| Java | no equivalent on `Window` |
| C# | [`LibTmux.Window.SwapAsync`](/en/csharp/latest/reference/libtmux-window-swapasync/) (method) |
| C++ | [`libtmux::Window::swap_with`](/en/cxx/latest/reference/libtmux-window-swap_with/) (method) |
| Swift | [`Server.swap(_:with:)`](/en/swift/latest/reference/server-swap(_-with-)/) (method) |

No equivalent is recorded in Ruby, PowerShell, Julia, Elixir, Kotlin, Scala or F#.
