Overview
Window rules let you adjust behavior for individual windows. They havematch and exclude directives that control which windows the rule should apply to, and a number of properties that you can set.
Window rules are processed in order of appearance in the config file. This means that you can put more generic rules first, then override them for specific windows later.
In general, you cannot “unset” a property in a later rule, only set it to a different value. Use the
exclude directives to avoid applying a rule for specific windows.Window Matching
Each window rule can have severalmatch and exclude directives. In order for the rule to apply, a window needs to match any of the match directives, and none of the exclude directives.
Finding Window Info
You can find the title and the app ID of a window by running:Matchers
title and app-id
These are regular expressions that should match anywhere in the window title and app ID respectively.Raw KDL strings can be helpful for writing out regular expressions:
is-active
Can betrue or false. Matches active windows (same windows that have the active border / focus ring color).
Every workspace on the focused monitor will have one active window. This means that you will usually have multiple active windows.
is-focused
Can betrue or false. Matches the window that has the keyboard focus.
Contrary to
is-active, there can only be a single focused window. Also, when opening a layer-shell application launcher or pop-up menu, the keyboard focus goes to layer-shell.is-active-in-column
Can betrue or false. Matches the window that is the “active” window in its column.
Contrary to
is-active, there is always one is-active-in-column window in each column. It is the window that was last focused in the column. This rule will match true during the initial window opening.is-floating
Can betrue or false. Matches floating windows.
is-window-cast-target
Can betrue or false. Matches true for windows that are target of an ongoing window screencast.
This only matches individual-window screencasts. It will not match windows that happen to be visible in a monitor screencast.
is-urgent
Can betrue or false. Matches windows that request the user’s attention.
at-startup
Can betrue or false. Matches during the first 60 seconds after starting niri.
This is useful for properties like
open-on-output which you may want to apply only right after starting niri.Window Opening Properties
These properties apply once, when a window first opens.default-column-width
Set the default width for the new window. This works for floating windows too, despite the word “column” in the name.default-window-height
Set the default height for the new window.open-on-output
Make the window open on a specific output.If such an output does not exist, the window will open on the currently focused output as usual.
open-on-output can now use monitor manufacturer, model, and serial.open-on-workspace
Make the window open on a specific named workspace.open-maximized
Make the window open as a maximized column.open-maximized-to-edges
Make the window open maximized to edges.false to prevent a window from opening maximized to edges.
open-fullscreen
Make the window open fullscreen.false to prevent a window from opening fullscreen:
open-floating
Make the window open in the floating layout.open-focused
Set this tofalse to prevent this window from being automatically focused upon opening.
Dynamic Properties
These properties apply continuously to open windows.opacity
Set the opacity of the window.0.0 is fully transparent, 1.0 is fully opaque.
Opacity is applied on top of the window’s own opacity, so semitransparent windows will become even more transparent.Opacity can be toggled on or off for a window using the
toggle-window-rule-opacity action.block-out-from
You can block out windows from xdg-desktop-portal screencasts. They will be replaced with solid black rectangles.variable-refresh-rate
If set to true, whenever this window displays on an output with on-demand VRR, it will enable VRR on that output.default-column-display
Set the default display mode for columns created from this window. Can benormal or tabbed.
geometry-corner-radius
Set the corner radius of the window.On its own, this setting will only affect the border and the focus ring. If you’d like to force-round the corners of the window itself, set
clip-to-geometry true in addition to this setting.clip-to-geometry
Clips the window to its visual geometry. This will cut out any client-side window shadows, and also round window corners according togeometry-corner-radius.