# Mouse & Gestures (https://mangowm.github.io/docs/v0.19.3/bindings/mouse-gestures)

## Mouse Bindings [#mouse-bindings]

Assign actions to mouse button presses with optional modifier keys.

> **Info:** All of the bindings in this page (`mousebind`, `axisbind`, `gesturebind`, `switchbind`) support key modes via `key_mode=<name>`, using the exact same rules as `bind`. See [Keys: Key Modes](/bindings/keys).

### Syntax [#syntax]

```ini
mousebind=MODIFIERS,BUTTON,COMMAND,PARAMETERS
```

- **Modifiers**: `SUPER`, `CTRL`, `ALT`, `SHIFT`, `NONE`. Combine with `+` (e.g., `SUPER+CTRL`).
- **Buttons**: Can be specified in one of the following ways:
  - **Standard Names**: `btn_left`, `btn_right`, `btn_middle`, `btn_side`, `btn_extra`, `btn_forward`, `btn_back`, `btn_task`
  - **Hardware Codes**: `code:NUMBER` (e.g., `code:272`, `code:273`, useful for binding non-standard or extra mouse buttons)

### Examples [#examples]

```ini
# Window manipulation
mousebind=SUPER,btn_left,moveresize,curmove
mousebind=SUPER,btn_right,moveresize,curresize
mousebind=SUPER+CTRL,btn_right,killclient

mousebind=NONE,code:273,togglemaximizescreen,0
```

---

## Axis Bindings [#axis-bindings]

Map scroll wheel movements to actions for workspace and window navigation.

### Syntax [#syntax-1]

```ini
axisbind=MODIFIERS,DIRECTION,COMMAND,PARAMETERS
```

- **Direction**: `UP`, `DOWN`, `LEFT`, `RIGHT`

Matched wheel actions use `axis_bind_apply_timeout`. Lower values apply the
binding more often; higher values apply it less often.

### Examples [#examples-1]

```ini
axisbind=SUPER,UP,viewtoleft_have_client
axisbind=SUPER,DOWN,viewtoright_have_client
```

---

## Gesture Bindings [#gesture-bindings]

Enable trackpad swipe gestures for navigation and window management.

### Syntax [#syntax-2]

```ini
gesturebind=MODIFIERS,DIRECTION,FINGERS,COMMAND,PARAMETERS
```

- **Direction**: `up`, `down`, `left`, `right`
- **Fingers**: `3` or `4`

> **Info:** Gestures require proper trackpad configuration. See [Input Devices](/configuration/input) for trackpad settings like `tap_to_click` and `trackpad_disable_while_typing`.

### Drag previews for bound gestures [#drag-previews-for-bound-gestures]

`gesture_live=1` shows the transition while dragging for these gesturebind
commands:

```ini
# right drag -> previous tag
gesturebind=none,right,4,viewprev_have_client
# left drag -> next tag
gesturebind=none,left,4,viewnext_have_client

# swipe up -> overview
gesturebind=none,up,4,toggleoverview
# swipe down -> close overview
gesturebind=none,down,4,toggleoverview
```

Set `gesture_live=0` to disable previews and act only on release.

### Examples [#examples-2]

```ini
# 3-finger: Window focus
gesturebind=none,left,3,focusdir,left
gesturebind=none,right,3,focusdir,right
gesturebind=none,up,3,focusdir,up
gesturebind=none,down,3,focusdir,down

# 4-finger: Workspace navigation (right drag -> previous tag, left drag -> next)
gesturebind=none,right,4,viewprev_have_client
gesturebind=none,left,4,viewnext_have_client
gesturebind=none,up,4,toggleoverview
gesturebind=none,down,4,toggleoverview
```

---

## Switch Bindings [#switch-bindings]

Trigger actions on hardware switch events such as lid open/close, tablet mode,
and keypad slide.

### Syntax [#syntax-3]

```ini
switchbind=SWITCH_STATE,COMMAND[,PARAMETERS]
```

`PARAMETERS` is optional for commands that do not require an argument.

| Switch state       | Meaning                             |
| :----------------- | :---------------------------------- |
| `lid_on`           | Lid closed                          |
| `lid_off`          | Lid opened                          |
| `tablet_on`        | Convertible switched to tablet mode |
| `tablet_off`       | Convertible left tablet mode        |
| `keypad_slide_on`  | Sliding keypad exposed              |
| `keypad_slide_off` | Sliding keypad hidden               |

The Sway-style spellings `lid:on`, `lid:off`, `tablet:on`, `tablet:off`,
`keypad_slide:on`, and `keypad_slide:off` are also accepted.

Each binding matches both the switch type and its state. In particular, a
`lid_on` action is not run when a convertible enters tablet mode.

> **Warning:** Disable system lid handling in `/etc/systemd/logind.conf`:
>
> ```ini
> HandleLidSwitch=ignore
> HandleLidSwitchExternalPower=ignore
> HandleLidSwitchDocked=ignore
> ```

### Examples [#examples-3]

```ini
switchbind=lid_on,spawn,swaylock -f -c 000000
switchbind=lid_off,spawn,wlr-dpms on
switchbind=tablet_on,spawn,on-screen-keyboard
switchbind=tablet_off,spawn,killall on-screen-keyboard
```