Document background effects
Browse files at this commit0117d6953d58f6d7cc8ad03e1f1c90f008bcffe7Parent: 931123f6 changed files +206 -0
- docs/mkdocs.yaml +1 -0
- docs/wiki/Configuration:-Layer-Rules.md +33 -0
- docs/wiki/Configuration:-Miscellaneous.md +86 -0
- docs/wiki/Configuration:-Window-Rules.md +32 -0
- docs/wiki/Window-Effects.md +53 -0
- docs/wiki/_Sidebar.md +1 -0
docs/mkdocs.yamlmodified+1 -0
| @@ -85,6 +85,7 @@ nav: | |||
| 85 | - Xwayland: Xwayland.md | 85 | - Xwayland: Xwayland.md |
| 86 | - Gestures: Gestures.md | 86 | - Gestures: Gestures.md |
| 87 | - Fullscreen and Maximize: Fullscreen-and-Maximize.md | 87 | - Fullscreen and Maximize: Fullscreen-and-Maximize.md |
| 88 | + - Window Effects: Window-Effects.md | ||
| 88 | - Packaging niri: Packaging-niri.md | 89 | - Packaging niri: Packaging-niri.md |
| 89 | - Integrating niri: Integrating-niri.md | 90 | - Integrating niri: Integrating-niri.md |
| 90 | - Accessibility: Accessibility.md | 91 | - Accessibility: Accessibility.md |
docs/wiki/Configuration:-Layer-Rules.mdmodified+33 -0
| @@ -35,6 +35,13 @@ layer-rule { | |||
| 35 | geometry-corner-radius 12 | 35 | geometry-corner-radius 12 |
| 36 | place-within-backdrop true | 36 | place-within-backdrop true |
| 37 | baba-is-float true | 37 | baba-is-float true |
| 38 | + | ||
| 39 | + background-effect { | ||
| 40 | + xray true | ||
| 41 | + blur true | ||
| 42 | + noise 0.05 | ||
| 43 | + saturation 3 | ||
| 44 | + } | ||
| 38 | } | 45 | } |
| 39 | ``` | 46 | ``` |
| 40 | 47 | ||
| @@ -208,3 +215,29 @@ layer-rule { | |||
| 208 | baba-is-float true | 215 | baba-is-float true |
| 209 | } | 216 | } |
| 210 | ``` | 217 | ``` |
| 218 | + | ||
| 219 | +#### `background-effect` | ||
| 220 | + | ||
| 221 | +<sup>Since: next release</sup> | ||
| 222 | + | ||
| 223 | +Override the background effect options for this surface. | ||
| 224 | + | ||
| 225 | +- `xray`: set to `true` to enable the xray effect, or `false` to disable it. | ||
| 226 | +- `blur`: set to `true` to enable blur behind this surface, or `false` to force-disable it. | ||
| 227 | +- `noise`: amount of pixel noise added to the background (helps with color banding from blur). | ||
| 228 | +- `saturation`: color saturation of the background (`0` is desaturated, `1` is normal, `2` is 200% saturation). | ||
| 229 | + | ||
| 230 | +See the [window effects page](./Window-Effects.md) for an overview of background effects. | ||
| 231 | + | ||
| 232 | +```kdl | ||
| 233 | +// Make top and overlay layers use the regular blur (if enabled), | ||
| 234 | +// while bottom and background layers keep using the efficient xray blur. | ||
| 235 | +layer-rule { | ||
| 236 | + match layer="top" | ||
| 237 | + match layer="overlay" | ||
| 238 | + | ||
| 239 | + background-effect { | ||
| 240 | + xray false | ||
| 241 | + } | ||
| 242 | +} | ||
| 243 | +``` | ||
docs/wiki/Configuration:-Miscellaneous.mdmodified+86 -0
| @@ -54,6 +54,14 @@ hotkey-overlay { | |||
| 54 | config-notification { | 54 | config-notification { |
| 55 | disable-failed | 55 | disable-failed |
| 56 | } | 56 | } |
| 57 | + | ||
| 58 | +blur { | ||
| 59 | + // off | ||
| 60 | + passes 3 | ||
| 61 | + offset 3.0 | ||
| 62 | + noise 0.02 | ||
| 63 | + saturation 1.5 | ||
| 64 | +} | ||
| 57 | ``` | 65 | ``` |
| 58 | 66 | ||
| 59 | ### `spawn-at-startup` | 67 | ### `spawn-at-startup` |
| @@ -320,3 +328,81 @@ config-notification { | |||
| 320 | disable-failed | 328 | disable-failed |
| 321 | } | 329 | } |
| 322 | ``` | 330 | ``` |
| 331 | + | ||
| 332 | +### `blur` | ||
| 333 | + | ||
| 334 | +<sup>Since: next release</sup> | ||
| 335 | + | ||
| 336 | +Blur configuration that affects all background blur. | ||
| 337 | + | ||
| 338 | +See the [window effects page](./Window-Effects.md) for an overview of background effects. | ||
| 339 | + | ||
| 340 | +```kdl | ||
| 341 | +blur { | ||
| 342 | + // off | ||
| 343 | + passes 3 | ||
| 344 | + offset 3 | ||
| 345 | + noise 0.02 | ||
| 346 | + saturation 1.5 | ||
| 347 | +} | ||
| 348 | +``` | ||
| 349 | + | ||
| 350 | +#### `off` | ||
| 351 | + | ||
| 352 | +By default, blur is available on request by a window or layer surface (via the `ext-background-effect` protocol). | ||
| 353 | +You can also enable it manually with the `blur true` background effect [window](./Configuration:-Window-Rules.md#background-effect) or [layer](./Configuration:-Layer-Rules.md#background-effect) rule. | ||
| 354 | + | ||
| 355 | +Setting the `off` flag will disable all blur, both requested by the window, and configured in window rules. | ||
| 356 | + | ||
| 357 | +```kdl | ||
| 358 | +blur { | ||
| 359 | + off | ||
| 360 | +} | ||
| 361 | +``` | ||
| 362 | + | ||
| 363 | +#### `passes` and `offset` | ||
| 364 | + | ||
| 365 | +`passes` contols the number of downsample/upsample passes for dual kawase blur. | ||
| 366 | +More passes produce a larger, smoother blur, but cost more GPU resources. | ||
| 367 | + | ||
| 368 | +`offset` is the pixel offset multiplier for each pass. | ||
| 369 | +Offset `1` is the original dual kawase blur. | ||
| 370 | +Larger values produce a smoother blur, at no additional GPU cost. | ||
| 371 | + | ||
| 372 | +However, setting `offset` too big will produce visual artifacts. | ||
| 373 | +You will need to increase `passes` to be able to use a bigger `offset` without artifacts. | ||
| 374 | + | ||
| 375 | +When configuring blur, try increasing `offset` first (since it doesn't cause any extra GPU load) until you start getting artifacts. | ||
| 376 | +Then, if you still need smoother blur, increase `passes` by 1. | ||
| 377 | +Keep doing this until you get the desired visuals. | ||
| 378 | + | ||
| 379 | +```kdl | ||
| 380 | +blur { | ||
| 381 | + passes 3 | ||
| 382 | + offset 3.0 | ||
| 383 | +} | ||
| 384 | +``` | ||
| 385 | + | ||
| 386 | +#### `noise` | ||
| 387 | + | ||
| 388 | +Amount of noise to add on top of the blur. | ||
| 389 | + | ||
| 390 | +This is helpful to reduce color banding artifacts. | ||
| 391 | + | ||
| 392 | +```kdl | ||
| 393 | +blur { | ||
| 394 | + noise 0.02 | ||
| 395 | +} | ||
| 396 | +``` | ||
| 397 | + | ||
| 398 | +#### `saturation` | ||
| 399 | + | ||
| 400 | +Color saturation applied to the blurred background. | ||
| 401 | + | ||
| 402 | +Values above `1` increase saturation; values below `1` reduce it. | ||
| 403 | + | ||
| 404 | +```kdl | ||
| 405 | +blur { | ||
| 406 | + saturation 1.5 | ||
| 407 | +} | ||
| 408 | +``` | ||
docs/wiki/Configuration:-Window-Rules.mdmodified+32 -0
| @@ -100,6 +100,13 @@ window-rule { | |||
| 100 | tiled-state true | 100 | tiled-state true |
| 101 | baba-is-float true | 101 | baba-is-float true |
| 102 | 102 | ||
| 103 | + background-effect { | ||
| 104 | + xray true | ||
| 105 | + blur true | ||
| 106 | + noise 0.05 | ||
| 107 | + saturation 3 | ||
| 108 | + } | ||
| 109 | + | ||
| 103 | min-width 100 | 110 | min-width 100 |
| 104 | max-width 200 | 111 | max-width 200 |
| 105 | min-height 300 | 112 | min-height 300 |
| @@ -909,6 +916,31 @@ https://github.com/user-attachments/assets/3f4cb1a4-40b2-4766-98b7-eec014c19509 | |||
| 909 | 916 | ||
| 910 | </video> | 917 | </video> |
| 911 | 918 | ||
| 919 | +#### `background-effect` | ||
| 920 | + | ||
| 921 | +<sup>Since: next release</sup> | ||
| 922 | + | ||
| 923 | +Override the background effect options for this window. | ||
| 924 | + | ||
| 925 | +- `xray`: set to `true` to enable the xray effect, or `false` to disable it. | ||
| 926 | +- `blur`: set to `true` to enable blur behind this window, or `false` to force-disable it. | ||
| 927 | +- `noise`: amount of pixel noise added to the background (helps with color banding from blur). | ||
| 928 | +- `saturation`: color saturation of the background (`0` is desaturated, `1` is normal, `2` is 200% saturation). | ||
| 929 | + | ||
| 930 | +See the [window effects page](./Window-Effects.md) for an overview of background effects. | ||
| 931 | + | ||
| 932 | +```kdl | ||
| 933 | +// Make floating windows use the regular blur (if enabled), | ||
| 934 | +// while tiled windows keep using the efficient xray blur. | ||
| 935 | +window-rule { | ||
| 936 | + match is-floating=true | ||
| 937 | + | ||
| 938 | + background-effect { | ||
| 939 | + xray false | ||
| 940 | + } | ||
| 941 | +} | ||
| 942 | +``` | ||
| 943 | + | ||
| 912 | #### Size Overrides | 944 | #### Size Overrides |
| 913 | 945 | ||
| 914 | You can amend the window's minimum and maximum size in logical pixels. | 946 | You can amend the window's minimum and maximum size in logical pixels. |
docs/wiki/Window-Effects.mdadded+53 -0
| @@ -0,0 +1,53 @@ | |||
| 1 | +### Overview | ||
| 2 | + | ||
| 3 | +<sup>Since: next release</sup> | ||
| 4 | + | ||
| 5 | +You can apply background effects to windows and layer-shell surfaces. | ||
| 6 | +These include blur, xray, saturation, and noise. | ||
| 7 | +They can be enabled in the `background-effect {}` section of [window](./Configuration:-Window-Rules.md#background-effect) or [layer](./Configuration:-Layer-Rules.md#background-effect) rules. | ||
| 8 | + | ||
| 9 | +The window needs to be semitransparent for you to see the background effect (otherwise it's fully covered by the opaque window). | ||
| 10 | +Focus ring and border can also cover the background effect, see [this FAQ entry](./FAQ.md#why-are-transparent-windows-tinted-why-is-the-borderfocus-ring-showing-up-through-semitransparent-windows) for how to change this. | ||
| 11 | + | ||
| 12 | +### Blur | ||
| 13 | + | ||
| 14 | +Windows and layer surfaces can request their background to be blurred via the [`ext-background-effect` protocol](https://wayland.app/protocols/ext-background-effect-v1). | ||
| 15 | +In this case, the application will usually offer some "background blur" setting that you'll need to enable in its configuration. | ||
| 16 | + | ||
| 17 | +You can also enable blur on the niri side with the `blur true` background effect window rule: | ||
| 18 | + | ||
| 19 | +```kdl | ||
| 20 | +// Enable blur behind the foot terminal. | ||
| 21 | +window-rule { | ||
| 22 | + match app-id="^foot$" | ||
| 23 | + | ||
| 24 | + background-effect { | ||
| 25 | + blur true | ||
| 26 | + } | ||
| 27 | +} | ||
| 28 | + | ||
| 29 | +// Enable blur behind the fuzzel launcher. | ||
| 30 | +layer-rule { | ||
| 31 | + match namespace="^launcher$" | ||
| 32 | + | ||
| 33 | + background-effect { | ||
| 34 | + blur true | ||
| 35 | + } | ||
| 36 | +} | ||
| 37 | +``` | ||
| 38 | + | ||
| 39 | +Blur enabled via the window rule will follow the window corner radius set via [`geometry-corner-radius`](./Configuration:-Window-Rules.md#geometry-corner-radius). | ||
| 40 | +On the other hand, blur enabled through `ext-background-effect` will exactly follow the shape requested by the window. | ||
| 41 | +If the window or layer has clientside rounded corners or other complex shape, it should set a corresponding blur shape through `ext-background-effect`, then it will get correctly shaped background blur without any manual niri configuration. | ||
| 42 | + | ||
| 43 | +Global blur settings are configured in the [`blur {}` config section](./Configuration:-Miscellaneous.md#blur) and apply to all background blur. | ||
| 44 | + | ||
| 45 | +### Xray | ||
| 46 | + | ||
| 47 | +Xray makes the window background "see through" to your wallpaper, ignoring any other windows below. | ||
| 48 | +You can enable it with `xray true` background effect [window](./Configuration:-Window-Rules.md#background-effect) or [layer](./Configuration:-Layer-Rules.md#background-effect) rule. | ||
| 49 | + | ||
| 50 | +Xray is automatically enabled by default if any other background effect (like blur) is active. | ||
| 51 | +This is because it's much more efficient: with xray active, niri only needs to blur the background once, and then can reuse this blurred version with no extra work (since the wallpaper changes very rarely). | ||
| 52 | + | ||
| 53 | +If you have an animated wallpaper, xray will still have to recompute blur every frame, but that happens once and shared among all windows, rather than recomputed separately for each window. | ||
docs/wiki/_Sidebar.mdmodified+1 -0
| @@ -14,6 +14,7 @@ | |||
| 14 | * [Xwayland](./Xwayland.md) | 14 | * [Xwayland](./Xwayland.md) |
| 15 | * [Gestures](./Gestures.md) | 15 | * [Gestures](./Gestures.md) |
| 16 | * [Fullscreen and Maximize](./Fullscreen-and-Maximize.md) | 16 | * [Fullscreen and Maximize](./Fullscreen-and-Maximize.md) |
| 17 | +* [Window Effects](./Window-Effects.md) | ||
| 17 | * [Packaging niri](./Packaging-niri.md) | 18 | * [Packaging niri](./Packaging-niri.md) |
| 18 | * [Integrating niri](./Integrating-niri.md) | 19 | * [Integrating niri](./Integrating-niri.md) |
| 19 | * [Accessibility](./Accessibility.md) | 20 | * [Accessibility](./Accessibility.md) |