Skip to main content

Overview

Window rules let you adjust behavior for individual windows. They have match 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 several match 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:
Then click on the window in question.

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 be true 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 be true 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 be true 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 be true or false. Matches floating windows.
This matcher will apply only after the window is already open. This means that you cannot use it to change the window opening properties like default-window-height or open-on-workspace.

is-window-cast-target

Can be true 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 be true or false. Matches windows that request the user’s attention.

at-startup

Can be true 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.
You can also set this to false to prevent a window from opening maximized to edges.

open-fullscreen

Make the window open fullscreen.
You can also set this to false to prevent a window from opening fullscreen:

open-floating

Make the window open in the floating layout.

open-focused

Set this to false 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.
Alternatively, you can block out the window from all screen captures:
The window is not blocked out from third-party screenshot tools. If you open some screenshot tool with preview while screencasting, blocked out windows will be visible on the screencast.Be careful when blocking out windows based on a dynamically changing window title. When switching tabs, the old tab contents may show up on a screencast for an instant because window title is not double-buffered in the Wayland protocol.

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 be normal or tabbed.

geometry-corner-radius

Set the corner radius of the window.
Instead of one radius, you can set four, for each corner (top-left, top-right, bottom-right, bottom-left):
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 to geometry-corner-radius.

Size Overrides

You can amend the window’s minimum and maximum size in logical pixels.
Keep in mind that the window itself always has a final say in its size. These values instruct niri to never ask the window to be smaller than the minimum you set, or to be bigger than the maximum you set.max-height will only apply to automatically-sized windows if it is equal to min-height.

Example Configurations

WezTerm Initial Configure Workaround

Firefox Picture-in-Picture

Password Manager Privacy

Rounded Corners for All Windows