Basic Configuration
Where your config lives, how it loads, and how to reload it
Sweets is configured in Lua.
Your file is ~/.config/sweets/sweets.lua. Create it with:
sweets --init-config| Command | Result |
|---|---|
sweets --init-config | Commented examples. Every default stays active. |
sweets --init-config PATH | Writes to PATH instead. |
It never overwrites an existing file.
Put only what you want to change:
sweets.general({
mod_key = "SUPER",
})
sweets.gaps({
inner = 12,
outer = 12,
})
sweets.bind("MOD+D", "spawn", { "fuzzel" })Don't edit the installed .../share/sweets/sweets.lua. Updates replace it.
How your file is applied
Sweets loads the installed defaults first, then your file on top.
| You write | Result |
|---|---|
A section like sweets.gaps | Your fields win. Fields you skip keep their default. |
| A key binding | Replaces the binding on the same keys. |
sweets.unbind("MOD+Q") | Removes a default binding. |
Window rules, layer rules, exec_once | Added after the defaults. |
Each section, like sweets.general, can appear only once in your file.
Reload
Sweets reloads when you save. To reload by hand, press Super+Shift+R or run:
sweets msg reloadIf your config has an error, Sweets keeps the last working one. The error shows at the top of every monitor until you fix it.
Check for errors
sweets --check-configThis checks your config without touching the running session.
Sandbox
Your config can use normal Lua: variables, functions, loops, tables, and the
string, table, math, and utf8 libraries.
It can't read files or run commands. Use these instead:
| Instead of | Use |
|---|---|
require | sweets.include |
os.execute | sweets.exec_once or a spawn binding |
A misspelled name is an error, not nil. natural_scroll = falsed is rejected
instead of silently ignored.