# Key Bindings (https://mangowm.github.io/docs/v0.19.3/bindings/keys)

## Syntax [#syntax]

Key bindings follow this format:

```ini
bind[flags]=MODIFIERS,KEY,COMMAND,PARAMETERS
```

- **Modifiers**: `SUPER`, `CTRL`, `ALT`, `SHIFT`, `NONE` (combine with `+`, e.g. `SUPER+CTRL+ALT`).
- **Key**: Key name (from `xev` or `wev`) or keycode (e.g., `code:24` for `q`).

> **Info:** `bind` converts the key name to a keycode, so it keeps working while other layouts are active. The name is resolved against the layouts configured with `xkb_rules_layout` (`device:*:kb_layout` is not used here), in the order they are listed, and falls back to the reference `us` layout when none of them can produce the key name. This means `bind=SUPER,h` resolves to your own `h` key on layout variants such as Dvorak, and to the `us` position when only non-latin layouts are configured. Use `code:N` to bind a keycode directly, or `binds` to match the character the active layout produces.

### Flags [#flags]

- `l`: Works even when screen is locked.
- `s`: Uses keysym instead of keycode to bind.
- `r`: Triggers on key release instead of press.
- `p`: Pass key event to client.
- `c`: allow keybind conflict(need set in all conflict key).
- `n`: Fire once per press and ignore key repeat while the key is held (other binds keep repeating at `repeat_rate` / `repeat_delay`).

> **Info:** `c` has no effect on the `reload_config` and `load_config_file` dispatches, which always stop the current key event.

**Examples:**

```ini
bind=SUPER,Q,killclient
bindl=SUPER,L,spawn,swaylock

# Using keycode instead of key name
bind=ALT,code:24,killclient

# Combining keycodes for modifiers and keys
bind=code:64,code:24,killclient
bind=code:64+code:133,code:24,killclient

# Bind with no modifier
bind=NONE,XF86MonBrightnessUp,spawn,brightnessctl set +5%

# Bind a modifier key itself as the trigger key
bind=alt,shift_l,switch_keyboard_layout

# Allow keybind conflict
bindc=SUPER,a,resizewin,+10,0
bindc=SUPER,a,centerwin

# Fire once per press, ignore key repeat
bindn=SUPER,Return,spawn,foot
```

## Key Modes (Submaps) [#key-modes-submaps]

You can divide key bindings into named modes. Rules:

1. Set `key_mode=<name>` before a group of `bind` lines — those binds only apply in that mode.
2. If no `key_mode` is set before a bind, it belongs to the `default` mode.
3. The special `common` key_mode applies its binds **across all modes**.

> **Info:** Key modes also apply to the other input bindings — `mousebind`, `axisbind`, `gesturebind` and `switchbind` — which share the exact same `key_mode` rules as `bind`.

Use `setkeymode` to switch modes, and `mmsg get keymode` to query the current mode.

```ini
# Binds in 'common' apply in every mode
key_mode=common
bind=SUPER,r,reload_config

# Default mode bindings
key_mode=default
bind=ALT,Return,spawn,foot
bind=SUPER,F,setkeymode,resize

# 'resize' mode bindings
key_mode=resize
bind=NONE,Left,resizewin,-10,0
bind=NONE,Right,resizewin,+10,0
bind=NONE,Escape,setkeymode,default
```

### Single Modifier Key Binding [#single-modifier-key-binding]

When binding a modifier key itself, use `NONE` for press and the modifier name for release:

```ini
# Trigger on press of Super key
bind=none,Super_L,spawn,rofi -show run

# Trigger on release of Super key
bindr=Super,Super_L,spawn,rofi -show run
```

## Dispatchers List [#dispatchers-list]

### Window Management [#window-management]

| Command                   | Param              | Description                                                                                      |
| :------------------------ | :----------------- | :----------------------------------------------------------------------------------------------- |
| `killclient`              | `force`            | Close the focused window. If `force` is specified, sends `SIGKILL`.                              |
| `smartkillclient`         | -                  | Remove the focused window from the current tag(s) if it is on multiple tags; otherwise close it. |
| `togglefloating`          | -                  | Toggle floating state.                                                                           |
| `toggle_all_floating`     | -                  | Toggle all visible clients floating state.                                                       |
| `togglefullscreen`        | -                  | Toggle fullscreen.                                                                               |
| `togglefakefullscreen`    | -                  | Toggle "fake" fullscreen (remains constrained).                                                  |
| `togglemaximizescreen`    | -                  | Maximize window (keep decoration/bar).                                                           |
| `toggleglobal`            | -                  | Pin window to all tags.                                                                          |
| `toggle_render_border`    | -                  | Toggle border rendering.                                                                         |
| `centerwin`               | -                  | Center the floating window.                                                                      |
| `minimized`               | -                  | Minimize window to scratchpad.                                                                   |
| `restore_minimized`       | -                  | Restore minimized window to the currently focused tag.                                           |
| `toggle_scratchpad`       | -                  | Toggle scratchpad.                                                                               |
| `toggle_named_scratchpad` | `app_id,title,cmd` | Toggle named scratchpad. Launches app if not running, otherwise shows/hides it.                  |
| `toggle_special_tag`      | -                  | Toggle special workspace overlay (tiling scratchpad).                                            |
| `tag_special_tag`         | -                  | Move focused window to/from the special workspace overlay.                                       |
| `tag_special_silent`      | -                  | Silently move focused window to/from the special workspace overlay.                              |

### Focus & Movement [#focus--movement]

| Command                     | Param                                                         | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| :-------------------------- | :------------------------------------------------------------ | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `focusid`                   | -                                                             | Focus window (can target any window via IPC: `mmsg dispatch focusid client,<id>`)                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| `focusdir`                  | `left/right/up/down`                                          | Focus window in direction. In the monocle layout with tabs enabled, left/right cycle the tab chain when `focus_cross_monitor` is disabled; otherwise they cycle the focus stack.                                                                                                                                                                                                                                                                                                                                    |
| `focus_window_or_workspace` | `left/right/up/down`                                          | Focus window in direction; otherwise jump to the nearest adjacent tag that has clients, falling back to the next/previous tag if none.                                                                                                                                                                                                                                                                                                                                                                              |
| `focusstack`                | `next/prev`                                                   | Cycle focus within the stack.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| `overcircle`                | `next/prev/current_next/current_prev`                         | Open overview when closed; while it is open, cycle focus to the next/previous window on the current monitor. `current_next`/`current_prev` only show the current tagset's windows in the overview instead of all tags.                                                                                                                                                                                                                                                                                              |
| `focuslast`                 | -                                                             | Focus the previously active window.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| `switcher`                  | `next/prev`, `all_tag_next/all_tag_prev`, `all_next/all_prev` | Open or cycle the thumbnail switcher. `next`/`prev` list the current tag's windows, `all_tag_next`/`all_tag_prev` list all tags on the current monitor, `all_next`/`all_prev` list all monitors and tags. Releasing any modifier key selects.                                                                                                                                                                                                                                                                       |
| `exchange_client`           | `left/right/up/down`                                          | Swap the focused window with its neighbor in direction. Both windows change place, and with `exchange_cross_monitor` enabled they also swap monitors.                                                                                                                                                                                                                                                                                                                                                               |
| `exchange_stack_client`     | `next/prev`                                                   | Exchange window position in stack.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| `move_client`               | `left/right/up/down`                                          | Move the focused window one step in direction. On the same monitor `dwindle` re-inserts it next to the neighbor keeping the row/column it came from, every other layout swaps it with the neighbor like `exchange_client`. When the neighbor lies on another monitor the window moves onto that monitor and is inserted in front of or behind the neighbor on the side it comes from; without a neighbor in that direction it moves onto the monitor lying there. Crossing monitors needs `exchange_cross_monitor`. |
| `zoom`                      | -                                                             | Swap focused window with Master.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |

### Group [#group]

| Command      | Param                | Description                      |
| :----------- | :------------------- | :------------------------------- |
| `groupjoin`  | `left/right/up/down` | Join group by direction.         |
| `groupfocus` | `prev/next`          | Focus group member by direction. |
| `groupleave` | -                    | Leave group.                     |

### Tags & Monitors [#tags--monitors]

| Command                   | Param                                                 | Description                                                                                                                                                                                      |
| :------------------------ | :---------------------------------------------------- | :----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `view`                    | `mask[,synctag]`                                      | View tag(s). Accepts a [tag mask](/bindings/keys#tag-mask-format). Additionally, `00` shows all tags, `-1` shows the previous tagset. Optional `synctag` (0/1) syncs the action to all monitors. |
| `viewtoleft`              | `[synctag]`                                           | View previous tag. Optional `synctag` (0/1) syncs to all monitors.                                                                                                                               |
| `viewtoright`             | `[synctag]`                                           | View next tag. Optional `synctag` (0/1) syncs to all monitors.                                                                                                                                   |
| `view_insert`             | `prev`/`next`                                         | View the adjacent tag if it is empty; otherwise insert an empty tag before/after the current one and switch to it.                                                                               |
| `viewtoleft_have_client`  | `[synctag]`                                           | View left tag and focus client if present. Optional `synctag` (0/1).                                                                                                                             |
| `viewtoright_have_client` | `[synctag]`                                           | View right tag and focus client if present. Optional `synctag` (0/1).                                                                                                                            |
| `viewcrossmon`            | `mask,monitor_spec`                                   | View specified tag(s) on specified monitor. Accepts a [tag mask](/bindings/keys#tag-mask-format) and a [monitor spec](/configuration/monitors#monitor-spec-format).                              |
| `tag`                     | `mask[,synctag]`                                      | Move window to tag(s). Accepts a [tag mask](/bindings/keys#tag-mask-format). Optional `synctag` (0/1) syncs to all monitors.                                                                     |
| `tagsilent`               | `mask`                                                | Move window to tag(s) without focusing it. Accepts a [tag mask](/bindings/keys#tag-mask-format).                                                                                                 |
| `tagtoleft`               | `[synctag]`                                           | Move window to left tag. Optional `synctag` (0/1).                                                                                                                                               |
| `tagtoright`              | `[synctag]`                                           | Move window to right tag. Optional `synctag` (0/1).                                                                                                                                              |
| `tagcrossmon`             | `mask,monitor_spec`                                   | Move window to tag(s) on specified monitor. Accepts a [tag mask](/bindings/keys#tag-mask-format) and a [monitor spec](/configuration/monitors#monitor-spec-format).                              |
| `toggletag`               | `mask`                                                | Toggle tag(s) on window. Accepts a [tag mask](/bindings/keys#tag-mask-format). `00` toggles all tags.                                                                                            |
| `toggleview`              | `mask`                                                | Toggle view of tag(s). Accepts a [tag mask](/bindings/keys#tag-mask-format).                                                                                                                     |
| `comboview`               | `mask`                                                | View multiple tags simultaneously. Accepts a [tag mask](/bindings/keys#tag-mask-format) (typically built by pressing keys, e.g., `1                                                              | 3`). |
| `focusmon`                | `left/right/up/down/next/prev/monitor_spec`           | Focus monitor by direction, by cycling to the next or previous monitor (`next`/`prev`), or by [monitor spec](/configuration/monitors#monitor-spec-format).                                       |
| `tagmon`                  | `left/right/up/down/next/prev/monitor_spec,[keeptag]` | Move window to monitor by direction, by cycling to the next or previous monitor (`next`/`prev`), or by [monitor spec](/configuration/monitors#monitor-spec-format). `keeptag` is 0 or 1.         |

#### Tag Mask Format [#tag-mask-format]

A tag mask specifies one or more tags for commands that operate on tags.  
It is formed by tag numbers `1`–`9`, optionally combined with `|`.

- `3` – single tag 3
- `1|3|5` – tags 1, 3, and 5

### Layouts [#layouts]

| Command                          | Param                | Description                                                 |
| :------------------------------- | :------------------- | :---------------------------------------------------------- |
| `setlayout`                      | `name`               | Switch to layout (e.g., `scroller`, `tile`).                |
| `switch_layout`                  | -                    | Cycle through available layouts.                            |
| `incnmaster`                     | `+1/-1`              | Increase/Decrease number of master windows.                 |
| `setmfact`                       | `+0.05`              | Increase/Decrease master area size.                         |
| `set_proportion`                 | `float`              | Set scroller window proportion (0.0–1.0).                   |
| `switch_proportion_preset`       | -                    | Cycle proportion presets of scroller window.                |
| `scroller_stack`                 | `left/right/up/down` | Move window inside/outside scroller stack by direction.     |
| `incgaps`                        | `+/-value`           | Adjust gap size.                                            |
| `togglegaps`                     | -                    | Toggle gaps.                                                |
| `togglegroupbar`                 | -                    | Toggle the group bar on every tiled window.                 |
| `dwindle_toggle_split_direction` | -                    | Toggle split direction in dwindle layout.                   |
| `dwindle_split_horizontal`       | -                    | Set split window direction to horizontal in dwindle layout. |
| `dwindle_split_vertical`         | -                    | Set split window direction to vertical in dwindle layout.   |
| `dwindle_toggle_current_split`   | -                    | Toggle split direction of current window in dwindle layout. |

### System [#system]

| Command                      | Param                                          | Description                                                                                                                                                    |
| :--------------------------- | :--------------------------------------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `spawn`                      | `cmd`                                          | Execute a command.                                                                                                                                             |
| `spawn_shell`                | `cmd`                                          | Execute shell command (supports pipes `\|`).                                                                                                                   |
| `spawn_on_empty`             | `cmd, tagmask`                                 | Open command on empty tag.Accepts a cmd string and [tagmask](/bindings/keys#tag-mask-format)                                                                   |
| `reload_config`              | -                                              | Hot-reload configuration. Does not support keybind conflict (`c` flag).                                                                                        |
| `load_config_file`           | `file path`                                    | Load configuration from the specified file. Empty path resets to default config location. Does not support keybind conflict (`c` flag).                        |
| `quit`                       | -                                              | Exit mangowm.                                                                                                                                                  |
| `toggleoverview`             | `[1]`                                          | Toggle overview mode. Passing `1` only shows the current tagset's windows in the overview instead of all tags.                                                 |
| `enteroverview`              | -                                              | Enter overview mode.                                                                                                                                           |
| `leaveoverview`              | -                                              | Leave overview mode.                                                                                                                                           |
| `toggleworkspaceoverview`    | `[all\|occupied\|scroll_all\|scroll_occupied]` | Toggle the draggable workspace overview. `all` includes empty tags, `occupied` shows only occupied tags, and the `scroll_*` variants use the scrolling layout. |
| `enterworkspaceoverview`     | `[all\|occupied\|scroll_all\|scroll_occupied]` | Enter the draggable workspace overview with the selected scope and layout.                                                                                     |
| `leaveworkspaceoverview`     | -                                              | Leave the draggable workspace overview.                                                                                                                        |
| `togglejump`                 | -                                              | Toggle overview with jump mode.                                                                                                                                |
| `create_virtual_output`      | -                                              | Create a headless monitor (for VNC/Sunshine).                                                                                                                  |
| `destroy_all_virtual_output` | -                                              | Destroy all virtual monitors.                                                                                                                                  |
| `toggleoverlay`              | -                                              | Toggle overlay state for the focused window.                                                                                                                   |
| `toggle_trackpad_enable`     | -                                              | Toggle trackpad enable.                                                                                                                                        |
| `setkeymode`                 | `mode`                                         | Set key_mode.                                                                                                                                                  |
| `switch_keyboard_layout`     | `[index]`                                      | Switch keyboard layout. Optional index (0, 1, 2...) to switch to specific layout.                                                                              |
| `setoption`                  | `key,value`                                    | Set config option temporarily.                                                                                                                                 |
| `sleep_monitor`              | `monitor_spec`                                 | Shutdown monitor power but not remove. Accepts a [monitor spec](/configuration/monitors#monitor-spec-format).                                                  |
| `wakeup_monitor`             | `monitor_spec`                                 | Turn on monitor power. Accepts a [monitor spec](/configuration/monitors#monitor-spec-format).                                                                  |
| `sleep_toggle_monitor`       | `monitor_spec`                                 | Toggle monitor power but not remove. Accepts a [monitor spec](/configuration/monitors#monitor-spec-format).                                                    |
| `disable_monitor`            | `monitor_spec`                                 | remove monitor. Accepts a [monitor spec](/configuration/monitors#monitor-spec-format).                                                                         |
| `enable_monitor`             | `monitor_spec`                                 | add monitor. Accepts a [monitor spec](/configuration/monitors#monitor-spec-format).                                                                            |
| `toggle_monitor`             | `monitor_spec`                                 | Toggle monitor add/remove. Accepts a [monitor spec](/configuration/monitors#monitor-spec-format).                                                              |

### Media Controls [#media-controls]

> **Warning:** Some keyboards don't send standard media keys. Run `wev` and press your key to check the exact key name.

#### Brightness [#brightness]

Requires: `brightnessctl`

```ini
bind=NONE,XF86MonBrightnessUp,spawn,brightnessctl s +2%
bind=SHIFT,XF86MonBrightnessUp,spawn,brightnessctl s 100%
bind=NONE,XF86MonBrightnessDown,spawn,brightnessctl s 2%-
bind=SHIFT,XF86MonBrightnessDown,spawn,brightnessctl s 1%
```

#### Volume [#volume]

Requires: `wpctl` (WirePlumber)

```ini
bind=NONE,XF86AudioRaiseVolume,spawn,wpctl set-volume @DEFAULT_SINK@ 5%+
bind=NONE,XF86AudioLowerVolume,spawn,wpctl set-volume @DEFAULT_SINK@ 5%-
bind=NONE,XF86AudioMute,spawn,wpctl set-mute @DEFAULT_SINK@ toggle
bind=SHIFT,XF86AudioMute,spawn,wpctl set-mute @DEFAULT_SOURCE@ toggle
```

#### Playback [#playback]

Requires: `playerctl`

```ini
bind=NONE,XF86AudioNext,spawn,playerctl next
bind=NONE,XF86AudioPrev,spawn,playerctl previous
bind=NONE,XF86AudioPlay,spawn,playerctl play-pause
```

### Floating Window Movement [#floating-window-movement]

| Command          | Param                | Description                              |
| :--------------- | :------------------- | :--------------------------------------- |
| `smartmovewin`   | `left/right/up/down` | Move floating window by snap distance.   |
| `smartresizewin` | `left/right/up/down` | Resize floating window by snap distance. |
| `movewin`        | `(x,y)`              | Move floating window.                    |
| `resizewin`      | `(width,height)`     | Resize window.                           |