mangowmmangowm

Key Bindings

Define keyboard shortcuts and modes.

Syntax

Key bindings follow this format:

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

  • 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).

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

Examples:

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

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.

# 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

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

# 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

Window Management

CommandParamDescription
killclientforceClose 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_scratchpadapp_id,title,cmdToggle 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

CommandParamDescription
focusid-Focus window (can target any window via IPC: mmsg dispatch focusid client,<id>)
focusdirleft/right/up/downFocus window in direction.
focus_window_or_workspaceleft/right/up/downFocus window in direction; otherwise jump to the nearest adjacent tag that has clients, falling back to the next/previous tag if none.
focusstacknext/prevCycle focus within the stack.
overcirclenext/prev/current_next/current_prevOpen 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.
switchernext/prev, all_tag_next/all_tag_prev, all_next/all_prevOpen 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_clientleft/right/up/downSwap the focused window with its neighbor in direction. Both windows change place, and with exchange_cross_monitor enabled they also swap monitors.
exchange_stack_clientnext/prevExchange window position in stack.
move_clientleft/right/up/downMove 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

CommandParamDescription
groupjoinleft/right/up/downJoin group by direction.
groupfocusprev/nextFocus group member by direction.
groupleave-Leave group.

Tags & Monitors

CommandParamDescription
viewmask[,synctag]View tag(s). Accepts a tag mask. 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_insertprev/nextView 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).
viewcrossmonmask,monitor_specView specified tag(s) on specified monitor. Accepts a tag mask and a monitor spec.
tagmask[,synctag]Move window to tag(s). Accepts a tag mask. Optional synctag (0/1) syncs to all monitors.
tagsilentmaskMove window to tag(s) without focusing it. Accepts a tag mask.
tagtoleft[synctag]Move window to left tag. Optional synctag (0/1).
tagtoright[synctag]Move window to right tag. Optional synctag (0/1).
tagcrossmonmask,monitor_specMove window to tag(s) on specified monitor. Accepts a tag mask and a monitor spec.
toggletagmaskToggle tag(s) on window. Accepts a tag mask. 00 toggles all tags.
toggleviewmaskToggle view of tag(s). Accepts a tag mask.
comboviewmaskView multiple tags simultaneously. Accepts a tag mask (typically built by pressing keys, e.g., `1
focusmonleft/right/up/down/next/prev/monitor_specFocus monitor by direction, by cycling to the next or previous monitor (next/prev), or by monitor spec.
tagmonleft/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. keeptag is 0 or 1.

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

CommandParamDescription
setlayoutnameSwitch to layout (e.g., scroller, tile).
switch_layout-Cycle through available layouts.
incnmaster+1/-1Increase/Decrease number of master windows.
setmfact+0.05Increase/Decrease master area size.
set_proportionfloatSet scroller window proportion (0.0–1.0).
switch_proportion_preset-Cycle proportion presets of scroller window.
scroller_stackleft/right/up/downMove window inside/outside scroller stack by direction.
incgaps+/-valueAdjust 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

CommandParamDescription
spawncmdExecute a command.
spawn_shellcmdExecute shell command (supports pipes |).
spawn_on_emptycmd, tagmaskOpen command on empty tag.Accepts a cmd string and tagmask
reload_config-Hot-reload configuration. Does not support keybind conflict (c flag).
load_config_filefile pathLoad 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.
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.
setkeymodemodeSet key_mode.
switch_keyboard_layout[index]Switch keyboard layout. Optional index (0, 1, 2...) to switch to specific layout.
setoptionkey,valueSet config option temporarily.
sleep_monitormonitor_specShutdown monitor power but not remove. Accepts a monitor spec.
wakeup_monitormonitor_specTurn on monitor power. Accepts a monitor spec.
sleep_toggle_monitormonitor_specToggle monitor power but not remove. Accepts a monitor spec.
disable_monitormonitor_specremove monitor. Accepts a monitor spec.
enable_monitormonitor_specadd monitor. Accepts a monitor spec.
toggle_monitormonitor_specToggle monitor add/remove. Accepts a monitor spec.

Media Controls

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

Brightness

Requires: brightnessctl

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

Requires: wpctl (WirePlumber)

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

Requires: playerctl

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

Floating Window Movement

CommandParamDescription
smartmovewinleft/right/up/downMove floating window by snap distance.
smartresizewinleft/right/up/downResize floating window by snap distance.
movewin(x,y)Move floating window.
resizewin(width,height)Resize window.

On this page