OPINIONATED OMARCHY
TROUBLESHOOTING CORPUS
790
RECORDS
790
AUDITED
0
UNCHECKED
2388
SOURCES
LIVE
hyprland-config low common DISPUTE

Get smart gaps (no gaps with one window) back under the Lua config

hyprlandarchomarchy
CORRECTED An auditor found the fix wrong or incomplete and rewrote it. · checked against Omarchy omarchy 4.0.4-1 on 2026-10-05
AUDIT NOTE

The fix matches the hyprland-wiki code-snippets page ('Smart gaps' and 'Smart gaps (ignoring special workspaces)') line for line, and gaps_in and gaps_out are real hl.workspace_rule fields in v0.56.2 (WORKSPACE_RULE_FIELDS in LuaBindingsConfigRules.cpp). Discussion 8530 is the question about keeping gaps on special workspaces that the s[false] variant answers. no_gaps_when_only is absent from the current config-options page. On Omarchy 4.0.4-1, ~/.config/hypr/looknfeel.lua is required by the shipped hyprland.lua after the defaults, and omarchy-hyprland-window-gaps-toggle exists and toggles default/hypr/toggles/window-no-gaps.lua. The symptom was wrong: it quotes the hyprlang error 'config option ... does not exist', which cannot appear under a Lua config. In Lua an unknown option is reported by hl.config as unknown config key '<category>.<key>' (LuaBindingsConfigRules.cpp line 1002), and the old workspace line is a Lua syntax error, confirmed with Lua 5.5.1: 'workspace = w[tv1], gapsout:0' gives <name> expected near '0'. Symptom rewritten. The rules were not exercised in a live session.

The cause above was not rewritten and may still contain the error described. The fix below is the corrected version.

Symptom

You want no gaps and no border when a workspace has a single window, as no_gaps_when_only used to do, but that option no longer exists. Under the Lua config, hl.config({ dwindle = { no_gaps_when_only = 1 } }) is reported as unknown config key 'dwindle.no_gaps_when_only', and an old workspace = w[tv1], gapsout:0 line copied into a .lua file is a Lua syntax error, <name> expected near '0'.

Cause

Hyprland removed no_gaps_when_only in favour of workspace and window rules keyed on workspace selectors (w[tv1] for a workspace with one visible tiled window, f[1] for one with a maximized window). The hyprlang rule syntax does not carry over to Lua, so it has to be rewritten as hl.workspace_rule and hl.window_rule calls.

Fix

**Plain Arch**, in ~/.config/hypr/hyprland.lua (the Hyprland wiki snippet):


hl.workspace_rule({ workspace = "w[tv1]", gaps_out = 0, gaps_in = 0 })
hl.workspace_rule({ workspace = "f[1]", gaps_out = 0, gaps_in = 0 })
hl.window_rule({ match = { float = false, workspace = "w[tv1]" }, border_size = 0 })
hl.window_rule({ match = { float = false, workspace = "w[tv1]" }, rounding = 0 })
hl.window_rule({ match = { float = false, workspace = "f[1]" }, border_size = 0 })
hl.window_rule({ match = { float = false, workspace = "f[1]" }, rounding = 0 })

To keep gaps on special workspaces (the scratchpad), append s[false] with no space: "w[tv1]s[false]" and "f[1]s[false]".

**Omarchy 4.** Put the same lines in ~/.config/hypr/looknfeel.lua. For gaps off everywhere instead, Omarchy already has a toggle: omarchy-hyprland-window-gaps-toggle.

Verify

Open one tiled window on a workspace: it fills the screen with no border. Open a second: gaps and borders return.

Sources

smart-gaps-no-gaps-when-only-lua