Mouse & Gestures
Configure mouse buttons, scrolling, gestures, and lid switches.
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 viakey_mode=<name>, using the exact same rules asbind. See Keys: Key Modes.
Syntax
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)
- Standard Names:
Examples
# 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,0Axis Bindings
Map scroll wheel movements to actions for workspace and window navigation.
Syntax
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
axisbind=SUPER,UP,viewtoleft_have_client
axisbind=SUPER,DOWN,viewtoright_have_clientGesture Bindings
Enable trackpad swipe gestures for navigation and window management.
Syntax
gesturebind=MODIFIERS,DIRECTION,FINGERS,COMMAND,PARAMETERS- Direction:
up,down,left,right - Fingers:
3or4
Info: Gestures require proper trackpad configuration. See Input Devices for trackpad settings like
tap_to_clickandtrackpad_disable_while_typing.
Drag previews for bound gestures
gesture_live=1 shows the transition while dragging for these gesturebind
commands:
# 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,toggleoverviewSet gesture_live=0 to disable previews and act only on release.
Examples
# 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,toggleoverviewSwitch Bindings
Trigger actions on hardware switch events such as lid open/close, tablet mode, and keypad slide.
Syntax
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:HandleLidSwitch=ignore HandleLidSwitchExternalPower=ignore HandleLidSwitchDocked=ignore
Examples
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-keyboardLast updated on