Key Bindings
Bind keys and multi-key sequences with sweets.bind, plus the packaged default and media-key bindings.
sweets.bind(spec, action [, arg]) maps a key combination or short key sequence
to a compositor action.
sweets.bind(spec, action [, arg])
spec is one or more whitespace-separated key combinations. A combination is a
+-separated string of modifiers and one key, such as "MOD+Shift+Return".
MODexpands tomod_key. Other modifiers areShift,Ctrl,Alt, andSuper.- Key names match case-insensitively, so
qandQare the same key. UseShiftfor the shifted action. - Keys use xkb names:
Return,space,1,q, and theXF86multimedia keysyms. See Media keys.
sweets.bind("MOD+Return", "spawn", "foot")
sweets.bind("MOD+q", "close")
sweets.bind("MOD+Shift+q", "quit")Key sequences
Put spaces between steps for Emacs/Vim-style sequences. Release MOD after b,
then press f or c:
sweets.bind("MOD+b f", "spawn", "firefox")
sweets.bind("MOD+b c", "spawn", "chromium")The first step is consumed while Sweets waits for the next. A sequence times out
after one second. An unmatched next key cancels it and is consumed, so Escape
is a harmless way to cancel.
Sequences may have up to eight steps, each with its own modifiers. One sequence
cannot be the prefix of another binding — do not combine "MOD+b" and
"MOD+b f".
Actions
| Action | Arg | Description |
|---|---|---|
spawn | command string | Run a shell command |
close | — | Close the focused window |
quit | — | Exit the compositor |
reload | — | Reload this config (fail-safe) |
dismiss_error | — | Hide the config-error bar |
focus_next / focus_prev | — | Focus the next / previous window (cycle) |
focus_left / focus_right / focus_up / focus_down | — | Focus the nearest tiled window that way |
move_left / move_right / move_up / move_down | — | Move the focused window, swapping neighbors |
move_eject_left / move_eject_right / move_eject_up / move_eject_down | — | Eject the focused tab from its group, then move it |
resize_grow / resize_shrink | — | Grow / shrink the focused tiled window horizontally |
resize_grow_vertical / resize_shrink_vertical | — | Grow / shrink it vertically |
toggle_floating | — | Toggle floating on the focused window |
layout | layout name | Set the workspace layout: tile, dwindle, centered, grid, or columns |
cycle_layout | next / prev | Step through the cycle set (default next, wraps) |
group | — | Toggle a tabbed group on the focused window (alias toggle_group) |
cycle_tab | next / prev | Move focus between tabs in the focused window's group (default next, wraps) |
move_tab | next / prev | Reorder the focused tab one step (default next, wraps) |
eject | — | Pull the focused window out of its group into its own tile (alias tab_eject) |
master_position | position name | Set the master side: left, right, top, or bottom |
cycle_master_position | — | Rotate the master side (left → right → top → bottom, wraps) |
grid_balance | — | Reset a grid workspace to even rows and columns |
special_toggle | — | Show or hide the special workspace overlay |
special_move | — | Move the focused window into the special workspace |
fullscreen | — | Toggle fullscreen (alias toggle_fullscreen) |
maximize | — | Toggle full usable area, keeping outer gaps and borders (alias toggle_maximize) |
minimize | — | Hide the focused window from layout and focus, keeping its taskbar entry |
unminimize | — | Restore the last minimized window onto the current workspace (alias restore) |
workspace | number 1–10 | Switch to a workspace |
workspace_move | number 1–10 | Move the focused window to a workspace |
Notes on the directional actions:
- Focus and move actions can cross monitors. See
focus_cross_monitorandmove_cross_monitor. move_*on a window in a tabbed group carries the whole group.move_eject_*peels off just the focused tab, and falls back to a plainmove_*when the window is ungrouped.cycle_tab,move_tab, andejectare no-ops unless the focused window is in a group.
scratchpad_toggle and scratchpad_move are compatibility aliases for the
special-workspace actions.
Default bindings come from the packaged Lua config. A user config replaces any default by binding the same combo again. Defaults that are not rebound stay active.
If neither the packaged defaults nor your config provide bindings, Sweets uses
only the emergency C set: MOD+Return, MOD+q, MOD+Shift+q, and
MOD+Shift+r.
Default bindings
| Binding | Action |
|---|---|
MOD+Return | spawn foot |
MOD+q | close focused window |
MOD+Shift+q | quit the compositor |
MOD+Shift+r | reload config |
MOD+Shift+e | dismiss the config-error bar |
MOD+j / MOD+k | focus next / previous (cycle) |
MOD+h / MOD+l | focus left / right (directional) |
MOD+Arrows | focus left / right / up / down |
MOD+Shift+h / MOD+Shift+l | move focused window left / right |
MOD+Shift+j / MOD+Shift+k | move focused window down / up |
MOD+Shift+Arrows | move focused window left / right / up / down |
MOD+Space | toggle floating |
MOD+s | show or hide the special workspace |
MOD+Shift+s | move focused window to the special workspace |
MOD+f | toggle fullscreen |
MOD+Shift+f | toggle maximize |
MOD+m | minimize focused window |
MOD+Shift+m | restore the last minimized window |
MOD+= / MOD+- | grow / shrink horizontally |
MOD+Shift+= / MOD+Shift+- | grow / shrink vertically |
MOD+KP_Add / MOD+KP_Subtract | horizontal resize (with Shift: vertical) |
MOD+b, then f / c | spawn Firefox / Chromium |
MOD+[1-9], MOD+0 | switch workspace (MOD+0 is 10) |
MOD+Shift+[1-9], MOD+Shift+0 | move focused window to workspace |
MOD is the configured mod_key, default SUPER.
The special workspace is a private, modal workspace shown as a dimmed overlay on
the active output. Its windows use the normal layout and gap settings. Windows
mapped while it is open join it automatically. Set the dim color with
sweets.special({ dim = "#000000A6" }).
Media keys
The packaged config binds the XF86 multimedia keys to helper commands via
spawn. They have no modifier, so they work straight from a laptop's keys. Each
needs the matching tool installed.
| Binding | Action | Tool |
|---|---|---|
XF86AudioRaiseVolume | raise volume 5% (capped at 100%) | wpctl |
XF86AudioLowerVolume | lower volume 5% | wpctl |
XF86AudioMute | toggle output mute | wpctl |
XF86AudioMicMute | toggle microphone mute | wpctl |
XF86MonBrightnessUp | raise backlight 5% | brightnessctl |
XF86MonBrightnessDown | lower backlight 5% | brightnessctl |
XF86AudioPlay / XF86AudioPause | play / pause | playerctl |
XF86AudioNext / XF86AudioPrev | next / previous track | playerctl |
XF86AudioStop | stop playback | playerctl |
The volume binds use wpctl (PipeWire/WirePlumber). On PulseAudio, rebind
them to the pactl equivalents shown in the packaged sweets.lua.