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, e.g. "MOD+Shift+Return".
MOD expands to mod_key; other modifiers are Shift,
Ctrl, Alt, Super. The key name is matched case-insensitively (so q and
Q are the same key; use Shift for the shifted action). Keys use xkb names
(Return, space, 1, q, …), including the XF86 multimedia keysyms such as
XF86AudioRaiseVolume, XF86AudioMute, and XF86MonBrightnessUp for media keys
(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 to create Emacs/Vim-style sequences. For example,
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 one. A sequence times
out after one second; an unmatched next key also cancels it and is consumed.
Pressing Escape is therefore a harmless way to cancel a pending sequence.
Sequences may contain up to eight steps, and each step may have its own
modifiers. One sequence cannot be the prefix of another binding: use distinct
bindings rather than combining, for example, "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 (it returns on the next failed reload) |
focus_next | — | Focus the next window (cycle) |
focus_prev | — | Focus the previous window (cycle) |
focus_left | — | Focus the nearest tiled window left (crosses monitors, see focus_cross_monitor) |
focus_right | — | Focus the nearest tiled window right (crosses monitors, see focus_cross_monitor) |
focus_up | — | Focus the nearest tiled window up (crosses monitors, see focus_cross_monitor) |
focus_down | — | Focus the nearest tiled window down (crosses monitors, see focus_cross_monitor) |
move_left | — | Move the focused window left, swapping neighbors (crosses monitors, see move_cross_monitor) |
move_right | — | Move the focused window right, swapping neighbors (crosses monitors, see move_cross_monitor) |
move_up | — | Move the focused window up, swapping neighbors (crosses monitors, see move_cross_monitor) |
move_down | — | Move the focused window down, swapping neighbors (crosses monitors, see move_cross_monitor) |
resize_grow | — | Grow the focused tiled window along the horizontal axis (master or stack, depending on master_position) |
resize_shrink | — | Shrink the focused tiled window along the horizontal axis |
resize_grow_vertical | — | Grow the focused tiled window along the vertical axis |
resize_shrink_vertical | — | Shrink the focused tiled window along the vertical axis |
toggle_floating | — | Toggle floating on the focused window |
layout | layout name | Set the active workspace's layout: tile, monocle, dwindle, centered, grid, or columns |
cycle_layout | next / prev (optional) | Step the active workspace through the cycle set (default next, wraps) |
master_position | position name | Set the active workspace's master side: left, right, top, or bottom |
cycle_master_position | — | Rotate the active workspace's master side (left → right → top → bottom, wraps) |
grid_balance | — | Reset the active grid workspace to even rows and columns (no-op on other layouts) |
special_toggle | — | Show or hide the private special workspace overlay |
special_move | — | Move the focused window into the private special workspace |
fullscreen | — | Toggle fullscreen on the focused window (alias toggle_fullscreen) |
maximize | — | Toggle the focused window to the full usable area, keeping outer gaps and borders (alias toggle_maximize) |
minimize | — | Minimize the focused window: hide it from the layout and focus, keeping its taskbar entry |
unminimize | — | Restore the most-recently-focused minimized window on the active workspace (alias restore) |
workspace | number 1–10 | Switch to a workspace (see workspace_mode) |
workspace_move | number 1–10 | Move the focused window to workspace (see workspace_move_follow) |
scratchpad_toggle and scratchpad_move are accepted compatibility aliases for
the special-workspace actions.
Default bindings come from the packaged Lua config. A user config can replace any single default by binding the same key combo again; defaults that are not rebound stay active.
If neither the packaged defaults nor the user config provide bindings, Sweets
uses only the emergency C set: MOD+Return, MOD+q, MOD+Shift+q, and
MOD+Shift+r.
Default bindings
These bindings are defined by the packaged Lua config and remain active unless the user config replaces them.
| 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 (directional) |
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 on focused window |
MOD+s | show or hide the special workspace |
MOD+Shift+s | move focused window to the special workspace |
MOD+f | toggle fullscreen on focused window |
MOD+Shift+f | toggle maximize (full usable area) on focused window |
MOD+m | minimize focused window |
MOD+Shift+m | restore the last minimized window |
MOD+= / MOD+- | grow / shrink the focused tiled window horizontally |
MOD+Shift+= / MOD+Shift+- | grow / shrink the focused stack window vertically |
MOD+KP_Add / MOD+KP_Subtract | horizontal resize (with Shift: vertical resize) |
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. Every assigned window appears together using the normal
master/stack layout and gap settings. Windows mapped while it is open join the
same special workspace automatically. Configure the dim color with
sweets.special({ dim = "#000000A6" }).
Media keys
The packaged config also binds the XF86 multimedia keys to external helper
commands via spawn. They have no modifier, so they work straight from a
laptop's volume/brightness/playback keys. Each needs the matching tool installed;
rebind or remove them in your user config if you use different tools.
| Binding | Action (default command) | 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 and mute binds use wpctl (PipeWire/WirePlumber). On a PulseAudio
system, rebind them to the pactl equivalents shown in the packaged
sweets.lua.