# cmd_swap_pane_exec

- **Language:** C
- **Kind:** function
- **Source:** https://github.com/tmux/tmux/blob/e476c1230b958df0cb12977517d24b3dc931375b/cmd-swap-pane.c#L46
- **Page:** https://libtmux.org/en/tmux/3.7c/reference/c-function-cmd-swap-pane-c-cmd_swap_pane_exec/

tmux command: [`swap-pane`](/en/tmux/3.7c/manual/swap-pane/)

```c
static enum cmd_retval cmd_swap_pane_exec(struct cmd *, struct cmdq_item *)
```

## Parameters

- `self` (`struct cmd *`)
- `item` (`struct cmdq_item *`)

## Calls

- [`args_has`](/en/tmux/3.7c/reference/c-function-args_has/) (function) [Call site](https://github.com/tmux/tmux/blob/e476c1230b958df0cb12977517d24b3dc931375b/cmd-swap-pane.c#L64)
- [`cmd_get_args`](/en/tmux/3.7c/reference/c-function-cmd_get_args/) (function) [Call site](https://github.com/tmux/tmux/blob/e476c1230b958df0cb12977517d24b3dc931375b/cmd-swap-pane.c#L48)
- [`cmdq_error`](/en/tmux/3.7c/reference/c-function-cmdq_error/) (function) [Call site](https://github.com/tmux/tmux/blob/e476c1230b958df0cb12977517d24b3dc931375b/cmd-swap-pane.c#L84)
- [`cmdq_get_source`](/en/tmux/3.7c/reference/c-function-cmdq_get_source/) (function) [Call site](https://github.com/tmux/tmux/blob/e476c1230b958df0cb12977517d24b3dc931375b/cmd-swap-pane.c#L49)
- [`cmdq_get_target`](/en/tmux/3.7c/reference/c-function-cmdq_get_target/) (function) [Call site](https://github.com/tmux/tmux/blob/e476c1230b958df0cb12977517d24b3dc931375b/cmd-swap-pane.c#L50)
- [`colour_palette_from_option`](/en/tmux/3.7c/reference/c-function-colour_palette_from_option/) (function) [Call site](https://github.com/tmux/tmux/blob/e476c1230b958df0cb12977517d24b3dc931375b/cmd-swap-pane.c#L153)
- [`layout_fix_panes`](/en/tmux/3.7c/reference/c-function-layout_fix_panes/) (function) [Call site](https://github.com/tmux/tmux/blob/e476c1230b958df0cb12977517d24b3dc931375b/cmd-swap-pane.c#L155)
- [`notify_window`](/en/tmux/3.7c/reference/c-function-notify_window/) (function) [Call site](https://github.com/tmux/tmux/blob/e476c1230b958df0cb12977517d24b3dc931375b/cmd-swap-pane.c#L161)
- [`options_set_parent`](/en/tmux/3.7c/reference/c-function-options_set_parent/) (function) [Call site](https://github.com/tmux/tmux/blob/e476c1230b958df0cb12977517d24b3dc931375b/cmd-swap-pane.c#L123)
- [`server_client_remove_pane`](/en/tmux/3.7c/reference/c-function-server_client_remove_pane/) (function) [Call site](https://github.com/tmux/tmux/blob/e476c1230b958df0cb12977517d24b3dc931375b/cmd-swap-pane.c#L88)
- [`server_redraw_window`](/en/tmux/3.7c/reference/c-function-server_redraw_window/) (function) [Call site](https://github.com/tmux/tmux/blob/e476c1230b958df0cb12977517d24b3dc931375b/cmd-swap-pane.c#L62)
- [`window_pane_is_floating`](/en/tmux/3.7c/reference/c-function-window_pane_is_floating/) (function) [Call site](https://github.com/tmux/tmux/blob/e476c1230b958df0cb12977517d24b3dc931375b/cmd-swap-pane.c#L82)
- [`window_pane_stack_remove`](/en/tmux/3.7c/reference/c-function-window_pane_stack_remove/) (function) [Call site](https://github.com/tmux/tmux/blob/e476c1230b958df0cb12977517d24b3dc931375b/cmd-swap-pane.c#L151)
- [`window_pop_zoom`](/en/tmux/3.7c/reference/c-function-window_pop_zoom/) (function) [Call site](https://github.com/tmux/tmux/blob/e476c1230b958df0cb12977517d24b3dc931375b/cmd-swap-pane.c#L166)
- [`window_push_zoom`](/en/tmux/3.7c/reference/c-function-window_push_zoom/) (function) [Call site](https://github.com/tmux/tmux/blob/e476c1230b958df0cb12977517d24b3dc931375b/cmd-swap-pane.c#L61)
- [`window_set_active_pane`](/en/tmux/3.7c/reference/c-function-window_set_active_pane/) (function) [Call site](https://github.com/tmux/tmux/blob/e476c1230b958df0cb12977517d24b3dc931375b/cmd-swap-pane.c#L138)

## Referenced by

- [`cmd_swap_pane_entry`](/en/tmux/3.7c/reference/c-variable-cmd_swap_pane_entry/) (attribute)

## Referenced declarations

- [`window.active`](/en/tmux/3.7c/reference/c-struct-window-active/) (attribute)
- [`cmd`](/en/tmux/3.7c/reference/c-struct-cmd/) (struct)
- [`CMD_RETURN_ERROR`](/en/tmux/3.7c/reference/c-enum-cmd_retval-cmd_return_error/) (constant)
- [`CMD_RETURN_NORMAL`](/en/tmux/3.7c/reference/c-enum-cmd_retval-cmd_return_normal/) (constant)
- [`cmd_retval`](/en/tmux/3.7c/reference/c-enum-cmd_retval/) (enum)
- [`cmdq_item`](/en/tmux/3.7c/reference/c-struct-cmdq_item/) (struct)
- [`layout_cell.entry`](/en/tmux/3.7c/reference/c-struct-layout_cell-entry/) (attribute)
- [`layout_cell.flags`](/en/tmux/3.7c/reference/c-struct-layout_cell-flags/) (attribute)
- [`window_pane.flags`](/en/tmux/3.7c/reference/c-struct-window_pane-flags/) (attribute)
- [`window.last_panes`](/en/tmux/3.7c/reference/c-struct-window-last_panes/) (attribute)
- [`window_pane.layout_cell`](/en/tmux/3.7c/reference/c-struct-window_pane-layout_cell/) (attribute)
- [`LAYOUT_CELL_FLOATING`](/en/tmux/3.7c/reference/c-define-tmux-h-layout_cell_floating/) (constant)
- [`window_pane.options`](/en/tmux/3.7c/reference/c-struct-window_pane-options/) (attribute)
- [`window.options`](/en/tmux/3.7c/reference/c-struct-window-options/) (attribute)
- [`window_pane.palette`](/en/tmux/3.7c/reference/c-struct-window_pane-palette/) (attribute)
- [`PANE_STYLECHANGED`](/en/tmux/3.7c/reference/c-define-tmux-h-pane_stylechanged/) (constant)
- [`PANE_THEMECHANGED`](/en/tmux/3.7c/reference/c-define-tmux-h-pane_themechanged/) (constant)
- [`window.panes`](/en/tmux/3.7c/reference/c-struct-window-panes/) (attribute)
- [`layout_cell.sx`](/en/tmux/3.7c/reference/c-struct-layout_cell-sx/) (attribute)
- [`window_pane.sx`](/en/tmux/3.7c/reference/c-struct-window_pane-sx/) (attribute)
- [`layout_cell.sy`](/en/tmux/3.7c/reference/c-struct-layout_cell-sy/) (attribute)
- [`window_pane.sy`](/en/tmux/3.7c/reference/c-struct-window_pane-sy/) (attribute)
- [`window_pane.window`](/en/tmux/3.7c/reference/c-struct-window_pane-window/) (attribute)
- [`winlink.window`](/en/tmux/3.7c/reference/c-struct-winlink-window/) (attribute)
- [`cmd_find_state.wl`](/en/tmux/3.7c/reference/c-struct-cmd_find_state-wl/) (attribute)
- [`cmd_find_state.wp`](/en/tmux/3.7c/reference/c-struct-cmd_find_state-wp/) (attribute)
- [`layout_cell.wp`](/en/tmux/3.7c/reference/c-struct-layout_cell-wp/) (attribute)
- [`layout_cell.xoff`](/en/tmux/3.7c/reference/c-struct-layout_cell-xoff/) (attribute)
- [`window_pane.xoff`](/en/tmux/3.7c/reference/c-struct-window_pane-xoff/) (attribute)
- [`layout_cell.yoff`](/en/tmux/3.7c/reference/c-struct-layout_cell-yoff/) (attribute)
- [`window_pane.yoff`](/en/tmux/3.7c/reference/c-struct-window_pane-yoff/) (attribute)
- [`window.z_index`](/en/tmux/3.7c/reference/c-struct-window-z_index/) (attribute)
