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, such as "MOD+Shift+Return".

  • MOD expands to mod_key. Other modifiers are Shift, Ctrl, Alt, and Super.
  • Key names match case-insensitively, so q and Q are the same key. Use Shift for the shifted action.
  • Keys use xkb names: Return, space, 1, q, and the XF86 multimedia 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

ActionArgDescription
spawncommand stringRun a shell command
closeClose the focused window
quitExit the compositor
reloadReload this config (fail-safe)
dismiss_errorHide the config-error bar
focus_next / focus_prevFocus the next / previous window (cycle)
focus_left / focus_right / focus_up / focus_downFocus the nearest tiled window that way
move_left / move_right / move_up / move_downMove the focused window, swapping neighbors
move_eject_left / move_eject_right / move_eject_up / move_eject_downEject the focused tab from its group, then move it
resize_grow / resize_shrinkGrow / shrink the focused tiled window horizontally
resize_grow_vertical / resize_shrink_verticalGrow / shrink it vertically
toggle_floatingToggle floating on the focused window
layoutlayout nameSet the workspace layout: tile, dwindle, centered, grid, or columns
cycle_layoutnext / prevStep through the cycle set (default next, wraps)
groupToggle a tabbed group on the focused window (alias toggle_group)
cycle_tabnext / prevMove focus between tabs in the focused window's group (default next, wraps)
move_tabnext / prevReorder the focused tab one step (default next, wraps)
ejectPull the focused window out of its group into its own tile (alias tab_eject)
master_positionposition nameSet the master side: left, right, top, or bottom
cycle_master_positionRotate the master side (left → right → top → bottom, wraps)
grid_balanceReset a grid workspace to even rows and columns
special_toggleShow or hide the special workspace overlay
special_moveMove the focused window into the special workspace
fullscreenToggle fullscreen (alias toggle_fullscreen)
maximizeToggle full usable area, keeping outer gaps and borders (alias toggle_maximize)
minimizeHide the focused window from layout and focus, keeping its taskbar entry
unminimizeRestore the last minimized window onto the current workspace (alias restore)
workspacenumber 110Switch to a workspace
workspace_movenumber 110Move the focused window to a workspace

Notes on the directional actions:

  • Focus and move actions can cross monitors. See focus_cross_monitor and move_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 plain move_* when the window is ungrouped.
  • cycle_tab, move_tab, and eject are 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

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
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
MOD+sshow or hide the special workspace
MOD+Shift+smove focused window to the special workspace
MOD+ftoggle fullscreen
MOD+Shift+ftoggle maximize
MOD+mminimize focused window
MOD+Shift+mrestore the last minimized window
MOD+= / MOD+-grow / shrink horizontally
MOD+Shift+= / MOD+Shift+-grow / shrink vertically
MOD+KP_Add / MOD+KP_Subtracthorizontal resize (with Shift: vertical)
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. 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.

BindingActionTool
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 binds use wpctl (PipeWire/WirePlumber). On PulseAudio, rebind them to the pactl equivalents shown in the packaged sweets.lua.

On this page