# LibTmux::Pane#swap

- **Module:** LibTmux
- **Package:** libtmux
- **Language:** Ruby
- **Kind:** method
- **Source:** https://github.com/libtmux/libtmux-ruby/blob/da7b6191b9439e3c84fa1c9eeaa9168263ee7af4/gems/libtmux/lib/libtmux/operations.rb#L336
- **Page:** https://libtmux.org/en/ruby/v0.1.1/reference/libtmux-pane-swap/

```
def swap: (
  ::LibTmux::EntityRef,
  ?timeout: ::Numeric,
  ?cancel: untyped
) -> ::LibTmux::CommandResult
```

Behavior: Entity mutation.

Behavior contract: Entity mutation.

## Parameters

- `arg1` (`::LibTmux::EntityRef`)
- `timeout` (`::Numeric`)
- `cancel` (`untyped`)

## tmux command

The tmux commands behind `swap`.

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

## tmux C API

The C declarations in tmux that implement these commands.

- [`cmd_swap_pane_entry`](/en/tmux/latest/reference/c-variable-cmd_swap_pane_entry/) (attribute)
- [`cmd_swap_pane_exec`](/en/tmux/latest/reference/c-function-cmd-swap-pane-c-cmd_swap_pane_exec/) (function)

## In other ports

Exchange two panes

| Language | Equivalent |
| --- | --- |
| Python | [`libtmux.Pane.swap`](/en/py/latest/reference/libtmux-pane-swap/) (method) |
| Lua | [`libtmux.Pane:swap`](/en/lua/latest/reference/libtmux-pane-swap/) (method) |
| TypeScript | [`pane.Pane.swapWith`](/en/ts/latest/reference/pane-pane-swapwith/) (method) |
| Rust | [`pane.Pane.swap_with`](/en/rs/latest/reference/pane-pane-swap_with/) (method) |
| Go | [`tmux.Pane.Swap`](/en/go/latest/reference/tmux-pane-swap/) (method) |
| Java | [`io.github.libtmux.Pane.swapWith`](/en/java/latest/reference/io-github-libtmux-pane-pane-swapwith/) (method) |
| C# | [`LibTmux.Pane.SwapAsync`](/en/csharp/latest/reference/libtmux-pane-swapasync/) (method) |
| C++ | [`libtmux::Pane::swap_with`](/en/cxx/latest/reference/libtmux-pane-swap_with/) (method) |
| Swift | `Server.swap(_:with:)` swaps windows, not panes |

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