How layer rules work in niri
mainLayer rules allow you to apply settings to specific layer surfaces (like bars, shells, or popups) based on matching criteria. Rules are processed in order, and non-null values overwrite values from previous matching rules.
Matching Logic
A layer rule matches if:
- Matches: Any rule in
layer-rules.*.matchessuccessfully matches the surface. Ifmatchesis empty, it matches everything. - Excludes: No rule in
layer-rules.*.excludesmatches the surface.
Match Rule Fields
Each match rule can use:
namespace: A regular expression to match against the surface's namespace.at-startup: A boolean. Iftrue, matches surfaces opened within the first 60 seconds of niri starting (e.g., viaspawn-at-startup). Iffalse, matches surfaces opened after 60 seconds.
Rule Inheritance
Rules are applied sequentially. If a field in a rule is null, it inherits the value from the previous applicable rule. If a field is non-null, it overwrites the previous value.