Sweets
Configuration

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

ActionArgDescription
spawncommand stringRun a shell command
closeClose the focused window
quitExit the compositor
reloadReload this config (fail-safe)
dismiss_errorHide the config-error bar (it returns on the next failed reload)
focus_nextFocus the next window (cycle)
focus_prevFocus the previous window (cycle)
focus_leftFocus the nearest tiled window left (crosses monitors, see focus_cross_monitor)
focus_rightFocus the nearest tiled window right (crosses monitors, see focus_cross_monitor)
focus_upFocus the nearest tiled window up (crosses monitors, see focus_cross_monitor)
focus_downFocus the nearest tiled window down (crosses monitors, see focus_cross_monitor)
move_leftMove the focused window left, swapping neighbors (crosses monitors, see move_cross_monitor)
move_rightMove the focused window right, swapping neighbors (crosses monitors, see move_cross_monitor)
move_upMove the focused window up, swapping neighbors (crosses monitors, see move_cross_monitor)
move_downMove the focused window down, swapping neighbors (crosses monitors, see move_cross_monitor)
resize_growGrow the focused tiled window along the horizontal axis (master or stack, depending on master_position)
resize_shrinkShrink the focused tiled window along the horizontal axis
resize_grow_verticalGrow the focused tiled window along the vertical axis
resize_shrink_verticalShrink the focused tiled window along the vertical axis
toggle_floatingToggle floating on the focused window
layoutlayout nameSet the active workspace's layout: tile, monocle, dwindle, centered, grid, or columns
cycle_layoutnext / prev (optional)Step the active workspace through the cycle set (default next, wraps)
master_positionposition nameSet the active workspace's master side: left, right, top, or bottom
cycle_master_positionRotate the active workspace's master side (left → right → top → bottom, wraps)
grid_balanceReset the active grid workspace to even rows and columns (no-op on other layouts)
special_toggleShow or hide the private special workspace overlay
special_moveMove the focused window into the private special workspace
fullscreenToggle fullscreen on the focused window (alias toggle_fullscreen)
maximizeToggle the focused window to the full usable area, keeping outer gaps and borders (alias toggle_maximize)
minimizeMinimize the focused window: hide it from the layout and focus, keeping its taskbar entry
unminimizeRestore the most-recently-focused minimized window on the active workspace (alias restore)
workspacenumber 110Switch to a workspace (see workspace_mode)
workspace_movenumber 110Move 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.

BindingAction
MOD+Returnspawn foot
MOD+qclose focused window
MOD+Shift+qquit the compositor
MOD+Shift+rreload config
MOD+Shift+edismiss the config-error bar
MOD+j / MOD+kfocus next / previous (cycle)
MOD+h / MOD+lfocus left / right (directional)
MOD+Arrowsfocus left / right / up / down (directional)
MOD+Shift+h / MOD+Shift+lmove focused window left / right
MOD+Shift+j / MOD+Shift+kmove focused window down / up
MOD+Shift+Arrowsmove focused window left / right / up / down
MOD+Spacetoggle floating on focused window
MOD+sshow or hide the special workspace
MOD+Shift+smove focused window to the special workspace
MOD+ftoggle fullscreen on focused window
MOD+Shift+ftoggle maximize (full usable area) on focused window
MOD+mminimize focused window
MOD+Shift+mrestore 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_Subtracthorizontal resize (with Shift: vertical resize)
MOD+b, then f / cspawn Firefox / Chromium
MOD+[1-9], MOD+0switch workspace (MOD+0 is 10)
MOD+Shift+[1-9], MOD+Shift+0move 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.

BindingAction (default command)Tool
XF86AudioRaiseVolumeraise volume 5% (capped at 100%)wpctl
XF86AudioLowerVolumelower volume 5%wpctl
XF86AudioMutetoggle output mutewpctl
XF86AudioMicMutetoggle microphone mutewpctl
XF86MonBrightnessUpraise backlight 5%brightnessctl
XF86MonBrightnessDownlower backlight 5%brightnessctl
XF86AudioPlay / XF86AudioPauseplay / pauseplayerctl
XF86AudioNext / XF86AudioPrevnext / previous trackplayerctl
XF86AudioStopstop playbackplayerctl

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.

On this page