forge
Explore
Log in

Don't you dare go Hollow

wiki: update wiki kdl snippets

Browse files at this commit

3be6e38af3c788be3d32ff006c72ad0b1787a879SuyashtntParent: f2290a4
Signed-off-by: Suyashtnt <suyashtnt@gmail.com>
wiki/Application-Issues.mdmodified+2 -2
@@ -20,11 +20,11 @@ Both of these can be fixed by resizing the new Chromium window.
2020
2121 There's [a bug](https://github.com/wez/wezterm/issues/4708) in WezTerm that it waits for a zero-sized Wayland configure event, so its window never shows up in niri. To work around it, put this window rule in the niri config (included in the default config):
2222
23-```
23+```kdl
2424 window-rule {
2525 match app-id=r#"^org\.wezfurlong\.wezterm$"#
2626 default-column-width {}
2727 }
2828 ```
2929
30-This empty default column width lets WezTerm pick its own initial width which makes it show up properly.
\ No newline at end of file
30+This empty default column width lets WezTerm pick its own initial width which makes it show up properly.
wiki/Configuration:-Animations.mdmodified+17 -17
@@ -5,7 +5,7 @@ Additionally, you can disable or slow down all animations at once.
55
66 Here's a quick glance at the available animations with their default values.
77
8-```
8+```kdl
99 animations {
1010 // Uncomment to turn off all animations.
1111 // You can also put "off" into each individual animation to disable it.
@@ -67,7 +67,7 @@ To use this animation, set the following parameters:
6767 - `duration-ms`: duration of the animation in milliseconds.
6868 - `curve`: the easing curve to use.
6969
70-```
70+```kdl
7171 animations {
7272 window-open {
7373 duration-ms 150
@@ -97,7 +97,7 @@ You can use the [Elastic](https://flathub.org/apps/app.drey.Elastic) app to help
9797
9898 A spring animation is configured like this, with three mandatory parameters:
9999
100-```
100+```kdl
101101 animations {
102102 workspace-switch {
103103 spring damping-ratio=1.0 stiffness=1000 epsilon=0.0001
@@ -134,7 +134,7 @@ Now let's go into more detail on the animations that you can configure.
134134
135135 Animation when switching workspaces up and down, including after the vertical touchpad gesture (a spring is recommended).
136136
137-```
137+```kdl
138138 animations {
139139 workspace-switch {
140140 spring damping-ratio=1.0 stiffness=1000 epsilon=0.0001
@@ -148,7 +148,7 @@ Window opening animation.
148148
149149 This one uses an easing type by default.
150150
151-```
151+```kdl
152152 animations {
153153 window-open {
154154 duration-ms 150
@@ -169,13 +169,13 @@ If a custom shader fails to compile, niri will print a warning and fall back to
169169 When running niri as a systemd service, you can see the warnings in the journal: `journalctl -ef /usr/bin/niri`
170170
171171 > [!WARNING]
172->
172+>
173173 > Custom shaders do not have a backwards compatibility guarantee.
174174 > I may need to change their interface as I'm developing new features.
175175
176176 Example: open will fill the current geometry with a solid gradient that gradually fades in.
177177
178-```
178+```kdl
179179 animations {
180180 window-open {
181181 duration-ms 250
@@ -208,7 +208,7 @@ Window closing animation.
208208
209209 This one uses an easing type by default.
210210
211-```
211+```kdl
212212 animations {
213213 window-close {
214214 duration-ms 150
@@ -229,13 +229,13 @@ If a custom shader fails to compile, niri will print a warning and fall back to
229229 When running niri as a systemd service, you can see the warnings in the journal: `journalctl -ef /usr/bin/niri`
230230
231231 > [!WARNING]
232->
232+>
233233 > Custom shaders do not have a backwards compatibility guarantee.
234234 > I may need to change their interface as I'm developing new features.
235235
236236 Example: close will fill the current geometry with a solid gradient that gradually fades away.
237237
238-```
238+```kdl
239239 animations {
240240 window-close {
241241 custom-shader r"
@@ -265,7 +265,7 @@ All horizontal camera view movement animations, such as:
265265 - When a new window appears off-screen and the camera scrolls to it.
266266 - After a horizontal touchpad gesture (a spring is recommended).
267267
268-```
268+```kdl
269269 animations {
270270 horizontal-view-movement {
271271 spring damping-ratio=1.0 stiffness=800 epsilon=0.0001
@@ -288,7 +288,7 @@ Includes:
288288
289289 This animation *does not* include the camera view movement, such as scrolling the workspace left and right.
290290
291-```
291+```kdl
292292 animations {
293293 window-movement {
294294 spring damping-ratio=1.0 stiffness=800 epsilon=0.0001
@@ -305,7 +305,7 @@ Window resize animation.
305305 Only manual window resizes are animated, i.e. when you resize the window with `switch-preset-column-width` or `maximize-column`.
306306 Also, very small resizes (up to 10 pixels) are not animated.
307307
308-```
308+```kdl
309309 animations {
310310 window-resize {
311311 spring damping-ratio=1.0 stiffness=800 epsilon=0.0001
@@ -325,13 +325,13 @@ If a custom shader fails to compile, niri will print a warning and fall back to
325325 When running niri as a systemd service, you can see the warnings in the journal: `journalctl -ef /usr/bin/niri`
326326
327327 > [!WARNING]
328->
328+>
329329 > Custom shaders do not have a backwards compatibility guarantee.
330330 > I may need to change their interface as I'm developing new features.
331331
332332 Example: resize will show the next (after resize) window texture right away, stretched to the current geometry.
333333
334-```
334+```kdl
335335 animations {
336336 window-resize {
337337 custom-shader r"
@@ -351,7 +351,7 @@ The open/close animation of the config parse error and new default config notifi
351351
352352 This one uses an underdamped spring by default (`damping-ratio=0.6`) which causes a slight oscillation in the end.
353353
354-```
354+```kdl
355355 animations {
356356 config-notification-open-close {
357357 spring damping-ratio=0.6 stiffness=1000 epsilon=0.001
@@ -365,7 +365,7 @@ animations {
365365
366366 The open (fade-in) animation of the screenshot UI.
367367
368-```
368+```kdl
369369 animations {
370370 screenshot-ui-open {
371371 duration-ms 200
wiki/Configuration:-Debug-Options.mdmodified+12 -27
@@ -9,7 +9,7 @@ They are not meant for normal use.
99
1010 Here are all the options at a glance:
1111
12-```
12+```kdl
1313 debug {
1414 preview-render "screencast"
1515 // preview-render "screen-capture"
@@ -20,7 +20,6 @@ debug {
2020 dbus-interfaces-in-non-session-instances
2121 wait-for-frame-completion-before-queueing
2222 emulate-zero-presentation-time
23- enable-color-transformations-capability
2423 }
2524
2625 binds {
@@ -36,7 +35,7 @@ Make niri render the monitors the same way as for a screencast or a screen captu
3635
3736 Useful for previewing the `block-out-from` window rule.
3837
39-```
38+```kdl
4039 debug {
4140 preview-render "screencast"
4241 // preview-render "screen-capture"
@@ -50,7 +49,7 @@ May cause frame drops during some animations on some hardware (which is why it i
5049
5150 Direct scanout into the primary plane is always enabled.
5251
53-```
52+```kdl
5453 debug {
5554 enable-overlay-planes
5655 }
@@ -63,7 +62,7 @@ The cursor will be rendered together with the rest of the frame.
6362
6463 Useful to work around driver bugs on specific hardware.
6564
66-```
65+```kdl
6766 debug {
6867 disable-cursor-plane
6968 }
@@ -73,7 +72,7 @@ debug {
7372
7473 Disable direct scanout to both the primary plane and the overlay planes.
7574
76-```
75+```kdl
7776 debug {
7877 disable-direct-scanout
7978 }
@@ -85,7 +84,7 @@ Override the DRM device that niri will use for all rendering.
8584
8685 You can set this to make niri use a different primary GPU than the default one.
8786
88-```
87+```kdl
8988 debug {
9089 render-drm-device "/dev/dri/renderD129"
9190 }
@@ -99,7 +98,7 @@ Useful for testing screencasting changes without having to relogin.
9998
10099 The main niri instance will *not* currently take back the interfaces when you close the test instance, so you will need to relogin in the end to make screencasting work again.
101100
102-```
101+```kdl
103102 debug {
104103 dbus-interfaces-in-non-session-instances
105104 }
@@ -111,7 +110,7 @@ Wait until every frame is done rendering before handing it over to DRM.
111110
112111 Useful for diagnosing certain synchronization and performance problems.
113112
114-```
113+```kdl
115114 debug {
116115 wait-for-frame-completion-before-queueing
117116 }
@@ -123,26 +122,12 @@ Emulate zero (unknown) presentation time returned from DRM.
123122
124123 This is a thing on NVIDIA proprietary drivers, so this flag can be used to test that niri doesn't break too hard on those systems.
125124
126-```
125+```kdl
127126 debug {
128127 emulate-zero-presentation-time
129128 }
130129 ```
131130
132-### `enable-color-transformations-capability`
133-
134-Enable the color-transformations capability of the Smithay renderer.
135-May cause a slight decrease in rendering performance.
136-
137-Currently, should cause no visible changes in behavior, but it will be needed for HDR support whenever that happens.
138-So, this flag exists to be able to make sure that nothing breaks.
139-
140-```
141-debug {
142- enable-color-transformations-capability
143-}
144-```
145-
146131 ### Key Bindings
147132
148133 These are not debug options, but rather key bindings.
@@ -153,7 +138,7 @@ Tints all surfaces green, unless they are being directly scanned out.
153138
154139 Useful to check if direct scanout is working.
155140
156-```
141+```kdl
157142 binds {
158143 Mod+Shift+Ctrl+T { toggle-debug-tint; }
159144 }
@@ -167,7 +152,7 @@ Tints regions marked as opaque with blue and the rest of the render elements wit
167152
168153 Useful to check how Wayland surfaces and internal render elements mark their parts as opaque, which is a rendering performance optimization.
169154
170-```
155+```kdl
171156 binds {
172157 Mod+Shift+Ctrl+O { debug-toggle-opaque-regions; }
173158 }
@@ -179,7 +164,7 @@ binds {
179164
180165 Tints damaged regions with red.
181166
182-```
167+```kdl
183168 binds {
184169 Mod+Shift+Ctrl+D { debug-toggle-damage; }
185170 }
wiki/Configuration:-Input.mdmodified+12 -12
@@ -8,7 +8,7 @@ Currently, there's no way to configure specific devices individually (but that i
88
99 All settings at a glance:
1010
11-```
11+```kdl
1212 input {
1313 keyboard {
1414 xkb {
@@ -81,7 +81,7 @@ In the `xkb` section, you can set layout, variant, options, model and rules.
8181 These are passed directly to libxkbcommon, which is also used by most other Wayland compositors.
8282 See the `xkeyboard-config(7)` manual for more information.
8383
84-```
84+```kdl
8585 input {
8686 keyboard {
8787 xkb {
@@ -99,7 +99,7 @@ You can control this with the `track-layout` option.
9999 - `global`: layout change is global for all windows.
100100 - `window`: layout is tracked for each window individually.
101101
102-```
102+```kdl
103103 input {
104104 keyboard {
105105 track-layout "global"
@@ -112,7 +112,7 @@ input {
112112 Delay is in milliseconds before the keyboard repeat starts.
113113 Rate is in characters per second.
114114
115-```
115+```kdl
116116 input {
117117 keyboard {
118118 repeat-delay 600
@@ -136,7 +136,7 @@ A few settings are common between `touchpad`, `mouse` and `trackpoint`:
136136 - `natural-scroll`: if set, inverts the scrolling direction.
137137 - `accel-speed`: pointer acceleration speed, valid values are from `-1.0` to `1.0` where the default is `0.0`.
138138 - `accel-profile`: can be `adaptive` (the default) or `flat` (disables pointer acceleration).
139-- `scroll-method`: when to generate scroll events instead of pointer motion events, can be `no-scroll`, `two-finger`, `edge`, or `on-button-down`.
139+- `scroll-method`: when to generate scroll events instead of pointer motion events, can be `no-scroll`, `two-finger`, `edge`, or `on-button-down`.
140140 The default and supported methods vary depending on the device type.
141141
142142 Settings specific to `touchpad`s:
@@ -154,7 +154,7 @@ Settings specific to `touchpad`, `mouse` and `tablet`:
154154
155155 Tablets and touchscreens are absolute pointing devices that can be mapped to a specific output like so:
156156
157-```
157+```kdl
158158 input {
159159 tablet {
160160 map-to-output "eDP-1"
@@ -179,7 +179,7 @@ These settings are not specific to a particular input device.
179179 By default, niri will take over the power button to make it sleep instead of power off.
180180 Set this if you would like to configure the power button elsewhere (i.e. `logind.conf`).
181181
182-```
182+```kdl
183183 input {
184184 disable-power-key-handling
185185 }
@@ -191,7 +191,7 @@ Makes the mouse warp to newly focused windows.
191191
192192 X and Y coordinates are computed separately, i.e. if moving the mouse only horizontally is enough to put it inside the newly focused window, then it will move only horizontally.
193193
194-```
194+```kdl
195195 input {
196196 warp-mouse-to-focus
197197 }
@@ -201,7 +201,7 @@ input {
201201
202202 Focuses windows and outputs automatically when moving the mouse over them.
203203
204-```
204+```kdl
205205 input {
206206 focus-follows-mouse
207207 }
@@ -211,14 +211,14 @@ input {
211211 Then, focus-follows-mouse won't focus a window if it will result in the view scrolling more than the set amount.
212212 The value is a percentage of the working area width.
213213
214-```
214+```kdl
215215 input {
216216 // Allow focus-follows-mouse when it results in scrolling at most 10% of the screen.
217217 focus-follows-mouse max-scroll-amount="10%"
218218 }
219219 ```
220220
221-```
221+```kdl
222222 input {
223223 // Allow focus-follows-mouse only when it will not scroll the view.
224224 focus-follows-mouse max-scroll-amount="0%"
@@ -232,7 +232,7 @@ If this flag is enabled, switching to the same workspace by index twice will swi
232232
233233 Niri will correctly switch to the workspace you came from, even if workspaces were reordered in the meantime.
234234
235-```
235+```kdl
236236 input {
237237 workspace-auto-back-and-forth
238238 }
wiki/Configuration:-Key-Bindings.mdmodified+18 -18
@@ -8,7 +8,7 @@ Key bindings are declared in the `binds {}` section of the config.
88 Each bind is a hotkey followed by one action enclosed in curly brackets.
99 For example:
1010
11-```
11+```kdl
1212 binds {
1313 Mod+Left { focus-column-left; }
1414 Super+Alt+L { spawn "swaylock"; }
@@ -53,7 +53,7 @@ For this reason, most of the default keys use the `Mod` modifier.
5353 <sup>Since: 0.1.8</sup> Binds will repeat by default (i.e. holding down a bind will make it trigger repeatedly).
5454 You can disable that for specific binds with `repeat=false`:
5555
56-```
56+```kdl
5757 binds {
5858 Mod+T repeat=false { spawn "alacritty"; }
5959 }
@@ -61,7 +61,7 @@ binds {
6161
6262 Binds can also have a cooldown, which will rate-limit the bind and prevent it from repeatedly triggering too quickly.
6363
64-```
64+```kdl
6565 binds {
6666 Mod+T cooldown-ms=500 { spawn "alacritty"; }
6767 }
@@ -74,7 +74,7 @@ This is mostly useful for the scroll bindings.
7474 You can bind mouse wheel scroll ticks using the following syntax.
7575 These binds will change direction based on the `natural-scroll` setting.
7676
77-```
77+```kdl
7878 binds {
7979 Mod+WheelScrollDown cooldown-ms=150 { focus-workspace-down; }
8080 Mod+WheelScrollUp cooldown-ms=150 { focus-workspace-up; }
@@ -88,7 +88,7 @@ Touchpad scrolling is continuous, so for these binds it is split into discrete i
8888
8989 These binds are also affected by touchpad's `natural-scroll`, so these example binds are "inverted", since niri has `natural-scroll` enabled for touchpads by default.
9090
91-```
91+```kdl
9292 binds {
9393 Mod+TouchpadScrollDown { spawn "wpctl" "set-volume" "@DEFAULT_AUDIO_SINK@" "0.02+"; }
9494 Mod+TouchpadScrollUp { spawn "wpctl" "set-volume" "@DEFAULT_AUDIO_SINK@" "0.02-"; }
@@ -112,7 +112,7 @@ Run a program.
112112 `spawn` accepts a path to the program binary as the first argument, followed by arguments to the program.
113113 For example:
114114
115-```
115+```kdl
116116 binds {
117117 // Run alacritty.
118118 Mod+T { spawn "alacritty"; }
@@ -128,7 +128,7 @@ binds {
128128 >
129129 > Spawn bindings have a special `allow-when-locked=true` property that makes them work even while the session is locked:
130130 >
131-> ```
131+> ```kdl
132132 > binds {
133133 > // This mute bind will work even when the session is locked.
134134 > XF86AudioMute allow-when-locked=true { spawn "wpctl" "set-mute" "@DEFAULT_AUDIO_SINK@" "toggle"; }
@@ -137,23 +137,23 @@ binds {
137137
138138 Currently, niri *does not* use a shell to run commands, which means that you need to manually separate arguments.
139139
140-```
140+```kdl
141141 binds {
142142 // Correct: every argument is in its own quotes.
143143 Mod+T { spawn "alacritty" "-e" "/usr/bin/fish"; }
144144
145145 // Wrong: will interpret the whole `alacritty -e /usr/bin/fish` string as the binary path.
146- Mod+T { spawn "alacritty -e /usr/bin/fish"; }
146+ Mod+D { spawn "alacritty -e /usr/bin/fish"; }
147147
148148 // Wrong: will pass `-e /usr/bin/fish` as one argument, which alacritty won't understand.
149- Mod+T { spawn "alacritty" "-e /usr/bin/fish"; }
149+ Mod+Q { spawn "alacritty" "-e /usr/bin/fish"; }
150150 }
151151 ```
152152
153153 This also means that you cannot expand environment variables or `~`.
154154 If you need this, you can run the command through a shell manually.
155155
156-```
156+```kdl
157157 binds {
158158 // Wrong: no shell expansion here. These strings will be passed literally to the program.
159159 Mod+T { spawn "grim" "-o" "$MAIN_OUTPUT" "~/screenshot.png"; }
@@ -161,17 +161,17 @@ binds {
161161 // Correct: run this through a shell manually so that it can expand the arguments.
162162 // Note that the entire command is passed as a SINGLE argument,
163163 // because shell will do its own argument splitting by whitespace.
164- Mod+T { spawn "sh" "-c" "grim -o $MAIN_OUTPUT ~/screenshot.png"; }
164+ Mod+D { spawn "sh" "-c" "grim -o $MAIN_OUTPUT ~/screenshot.png"; }
165165
166166 // You can also use a shell to run multiple commands,
167167 // use pipes, process substitution, and so on.
168- Mod+T { spawn "sh" "-c" "notify-send clipboard \"$(wl-paste)\""; }
168+ Mod+Q { spawn "sh" "-c" "notify-send clipboard \"$(wl-paste)\""; }
169169 }
170170 ```
171171
172172 As a special case, niri will expand `~` to the home directory *only* at the beginning of the program name.
173173
174-```
174+```kdl
175175 binds {
176176 // This will work: one ~ at the very beginning.
177177 Mod+T { spawn "~/scripts/do-something.sh"; }
@@ -182,7 +182,7 @@ binds {
182182
183183 Exit niri after showing a confirmation dialog to avoid accidentally triggering it.
184184
185-```
185+```kdl
186186 binds {
187187 Mod+Shift+E { quit; }
188188 }
@@ -190,7 +190,7 @@ binds {
190190
191191 If you want to skip the confirmation dialog, set the flag like so:
192192
193-```
193+```kdl
194194 binds {
195195 Mod+Shift+E { quit skip-confirmation=true; }
196196 }
@@ -202,7 +202,7 @@ binds {
202202
203203 Freeze the screen for a brief moment then crossfade to the new contents.
204204
205-```
205+```kdl
206206 binds {
207207 Mod+Return { do-screen-transition; }
208208 }
@@ -221,7 +221,7 @@ dconf write /org/gnome/desktop/interface/color-scheme "\"prefer-dark\""
221221 By default, the screen is frozen for 250 ms to give windows time to redraw, before the crossfade.
222222 You can set this delay like this:
223223
224-```
224+```kdl
225225 binds {
226226 Mod+Return { do-screen-transition delay-ms=100; }
227227 }
wiki/Configuration:-Layout.mdmodified+17 -17
@@ -4,7 +4,7 @@ In the `layout {}` section you can change various settings that influence how wi
44
55 Here are the contents of this section at a glance:
66
7-```
7+```kdl
88 layout {
99 gaps 16
1010 center-focused-column "never"
@@ -52,7 +52,7 @@ Set gaps around (inside and outside) windows in logical pixels.
5252 The value will be rounded to physical pixels according to the scale factor of every output.
5353 For example, `gaps 0.5` on an output with `scale 2` will result in one physical-pixel wide gaps.
5454
55-```
55+```kdl
5656 layout {
5757 gaps 16
5858 }
@@ -67,7 +67,7 @@ This can be set to:
6767 - `"always"`, the focused column will always be centered.
6868 - `"on-overflow"`, focusing a column will center it if it doesn't fit on screen together with the previously focused column.
6969
70-```
70+```kdl
7171 layout {
7272 center-focused-column "always"
7373 }
@@ -83,7 +83,7 @@ The default preset widths are <sup>1</sup>&frasl;<sub>3</sub>, <sup>1</sup>&fras
8383
8484 `fixed` sets the width in logical pixels exactly.
8585
86-```
86+```kdl
8787 layout {
8888 // Cycle between 1/3, 1/2, 2/3 of the output, and a fixed 1280 logical pixels.
8989 preset-column-widths {
@@ -108,7 +108,7 @@ Set the default width of the new windows.
108108
109109 The syntax is the same as in `preset-column-widths` above.
110110
111-```
111+```kdl
112112 layout {
113113 // Open new windows sized 1/3 of the output.
114114 default-column-width { proportion 0.33333; }
@@ -117,7 +117,7 @@ layout {
117117
118118 You can also leave the brackets empty, then the windows themselves will decide their initial width.
119119
120-```
120+```kdl
121121 layout {
122122 // New windows decide their initial width themselves.
123123 default-column-width {}
@@ -139,23 +139,23 @@ They are very similar and have the same options.
139139
140140 The difference is that the focus ring is drawn only around the active window, whereas borders are drawn around all windows and affect their sizes (windows shrink to make space for the borders).
141141
142-| Focus Ring | Border |
143-| ---------- | ------ |
142+| Focus Ring | Border |
143+| ------------------------- | --------------------- |
144144 | ![](./img/focus-ring.png) | ![](./img/border.png) |
145145
146146 > [!TIP]
147147 > By default, focus ring and border are rendered as a solid background rectangle behind windows.
148148 > That is, they will show up through semitransparent windows.
149149 > This is because windows using client-side decorations can have an arbitrary shape.
150->
150+>
151151 > If you don't like that, you should uncomment the `prefer-no-csd` setting at the [top level](./Configuration:-Miscellaneous.md) of the config.
152152 > Niri will draw focus rings and borders *around* windows that agree to omit their client-side decorations.
153->
153+>
154154 > Alternatively, you can override this behavior with the `draw-border-with-background` [window rule](https://github.com/YaLTeR/niri/wiki/Configuration:-Window-Rules).
155155
156156 Focus ring and border have the following options.
157157
158-```
158+```kdl
159159 layout {
160160 // focus-ring has the same options.
161161 border {
@@ -182,7 +182,7 @@ Set the thickness of the border in logical pixels.
182182 The value will be rounded to physical pixels according to the scale factor of every output.
183183 For example, `width 0.5` on an output with `scale 2` will result in one physical-pixel thick borders.
184184
185-```
185+```kdl
186186 layout {
187187 border {
188188 width 2
@@ -213,7 +213,7 @@ Gradients are rendered the same as CSS [`linear-gradient(angle, from, to)`](http
213213 The angle works the same as in `linear-gradient`, and is optional, defaulting to `180` (top-to-bottom gradient).
214214 You can use any CSS linear-gradient tool on the web to set these up, like [this one](https://www.css-gradient.com/).
215215
216-```
216+```kdl
217217 layout {
218218 focus-ring {
219219 active-gradient from="#80c8ff" to="#bbddff" angle=45
@@ -225,11 +225,11 @@ Gradients can be colored relative to windows individually (the default), or to t
225225 To do that, set `relative-to="workspace-view"`.
226226 Here's a visual example:
227227
228-| Default | `relative-to="workspace-view"` |
229-| --- | --- |
228+| Default | `relative-to="workspace-view"` |
229+| -------------------------------- | --------------------------------------------------- |
230230 | ![](./img/gradients-default.png) | ![](./img/gradients-relative-to-workspace-view.png) |
231231
232-```
232+```kdl
233233 layout {
234234 border {
235235 active-gradient from="#ffbb66" to="#ffc880" angle=45 relative-to="workspace-view"
@@ -251,7 +251,7 @@ Top and bottom struts will simply add outer gaps in addition to the area occupie
251251 The value will be rounded to physical pixels according to the scale factor of every output.
252252 For example, `top 0.5` on an output with `scale 2` will result in one physical-pixel wide top strut.
253253
254-```
254+```kdl
255255 layout {
256256 struts {
257257 left 64
wiki/Configuration:-Miscellaneous.mdmodified+8 -8
@@ -4,7 +4,7 @@ This page documents all top-level options that don't otherwise have dedicated pa
44
55 Here are all of these options at a glance:
66
7-```
7+```kdl
88 spawn-at-startup "waybar"
99 spawn-at-startup "alacritty"
1010
@@ -35,7 +35,7 @@ Add lines like this to spawn processes at niri startup.
3535
3636 This option works the same way as the `spawn` key binding action, so please read about all its subtleties on the [key bindings](./Configuration:-Key-Bindings.md) page.
3737
38-```
38+```kdl
3939 spawn-at-startup "waybar"
4040 spawn-at-startup "alacritty"
4141 ```
@@ -58,7 +58,7 @@ With `prefer-no-csd` set, applications that negotiate server-side decorations th
5858 >
5959 > Restart applications after changing `prefer-no-csd` in the config to apply it.
6060
61-```
61+```kdl
6262 prefer-no-csd
6363 ```
6464
@@ -71,13 +71,13 @@ The path is formatted with `strftime(3)` to give you the screenshot date and tim
7171
7272 Niri will create the last folder of the path if it doesn't exist.
7373
74-```
74+```kdl
7575 screenshot-path "~/Pictures/Screenshots/Screenshot from %Y-%m-%d %H-%M-%S.png"
7676 ```
7777
7878 You can also set this option to `null` to disable saving screenshots to disk.
7979
80-```
80+```kdl
8181 screenshot-path null
8282 ```
8383
@@ -85,7 +85,7 @@ screenshot-path null
8585
8686 Override environment variables for processes spawned by niri.
8787
88-```
88+```kdl
8989 environment {
9090 // Set a variable like this:
9191 // QT_QPA_PLATFORM "wayland"
@@ -99,7 +99,7 @@ environment {
9999
100100 Change the theme and size of the cursor as well as set the `XCURSOR_THEME` and `XCURSOR_SIZE` environment variables.
101101
102-```
102+```kdl
103103 cursor {
104104 xcursor-theme "breeze_cursors"
105105 xcursor-size 48
@@ -112,7 +112,7 @@ Settings for the "Important Hotkeys" overlay.
112112
113113 Set the `skip-at-startup` flag if you don't want to see the hotkey help at niri startup.
114114
115-```
115+```kdl
116116 hotkey-overlay {
117117 skip-at-startup
118118 }
wiki/Configuration:-Named-Workspaces.mdmodified+2 -2
@@ -4,7 +4,7 @@
44
55 You can declare named workspaces at the top level of the config:
66
7-```
7+```kdl
88 workspace "browser"
99
1010 workspace "chat" {
@@ -18,7 +18,7 @@ Otherwise, they behave like any other workspace: you can move them around, move
1818 Actions like `focus-workspace` or `move-column-to-workspace` can refer to workspaces by name.
1919 Also, you can use an `open-on-workspace` window rule to make a window open on a specific named workspace:
2020
21-```
21+```kdl
2222 // Declare a workspace named "chat" that opens on the "DP-2" output.
2323 workspace "chat" {
2424 open-on-output "DP-2"
wiki/Configuration:-Outputs.mdmodified+7 -7
@@ -5,7 +5,7 @@ You can disable or adjust this with `output` sections.
55
66 Here's what it looks like with all properties written out:
77
8-```
8+```kdl
99 output "eDP-1" {
1010 // off
1111 mode "1920x1080@120.030"
@@ -30,7 +30,7 @@ Matching by output manufacturer and model is planned, but blocked on Smithay ado
3030
3131 This flag turns off that output entirely.
3232
33-```
33+```kdl
3434 // Turn off that monitor.
3535 output "HDMI-A-1" {
3636 off
@@ -49,7 +49,7 @@ If the mode is omitted altogether or doesn't work, niri will try to pick one aut
4949 Run `niri msg outputs` while inside a niri instance to list all outputs and their modes.
5050 The refresh rate that you set here must match *exactly*, down to the three decimal digits, to what you see in `niri msg outputs`.
5151
52-```
52+```kdl
5353 // Set a high refresh rate for this monitor.
5454 // High refresh rate monitors tend to use 60 Hz as their preferred mode,
5555 // requiring a manual mode setting.
@@ -76,7 +76,7 @@ Set the scale of the monitor.
7676
7777 <sup>Since: 0.1.7</sup> Scale below 0 and above 10 will now fail during config parsing. Scale was previously clamped to these values anyway.
7878
79-```
79+```kdl
8080 output "eDP-1" {
8181 scale 2.0
8282 }
@@ -89,7 +89,7 @@ Rotate the output counter-clockwise.
8989 Valid values are: `"normal"`, `"90"`, `"180"`, `"270"`, `"flipped"`, `"flipped-90"`, `"flipped-180"` and `"flipped-270"`.
9090 Values with `flipped` additionally flip the output.
9191
92-```
92+```kdl
9393 output "HDMI-A-1" {
9494 transform "90"
9595 }
@@ -107,7 +107,7 @@ The cursor can only move between directly adjacent outputs.
107107 > For example, a 3840×2160 output with scale 2.0 will have a logical size of 1920×1080, so to put another output directly adjacent to it on the right, set its x to 1920.
108108 > If the position is unset or results in an overlap, the output is instead placed automatically.
109109
110-```
110+```kdl
111111 output "HDMI-A-1" {
112112 position x=1280 y=0
113113 }
@@ -140,7 +140,7 @@ You can check whether an output supports VRR in `niri msg outputs`.
140140 >
141141 > Some monitors will continuously modeset (flash black) with VRR enabled; I'm not sure if there's a way to fix it.
142142
143-```
143+```kdl
144144 output "HDMI-A-1" {
145145 variable-refresh-rate
146146 }
wiki/Configuration:-Overview.mdmodified+12 -8
@@ -40,10 +40,12 @@ Lines starting with `//` are comments; they are ignored.
4040
4141 Also, you can put `/-` in front of a section to comment out the entire section:
4242
43-```
43+```kdl
4444 /-output "eDP-1" {
45- everything inside here
46- is ignored
45+ // Everything inside here is ignored.
46+ // The display won't be turned off
47+ // as the whole section is commented out.
48+ off
4749 }
4850 ```
4951
@@ -53,7 +55,7 @@ Toggle options in niri are commonly represented as flags.
5355 Writing out the flag enables it, and omitting it or commenting it out disables it.
5456 For example:
5557
56-```
58+```kdl
5759 // "Focus follows mouse" is enabled.
5860 input {
5961 focus-follows-mouse
@@ -62,7 +64,7 @@ input {
6264 }
6365 ```
6466
65-```
67+```kdl
6668 // "Focus follows mouse" is disabled.
6769 input {
6870 // focus-follows-mouse
@@ -75,7 +77,7 @@ input {
7577
7678 Most sections cannot be repeated. For example:
7779
78-```
80+```kdl
7981 // This is valid: every section appears once.
8082 input {
8183 keyboard {
@@ -88,7 +90,8 @@ input {
8890 }
8991 ```
9092
91-```
93+<!-- no-test -->
94+```kdl
9295 // This is NOT valid: input section appears twice.
9396 input {
9497 keyboard {
@@ -105,7 +108,8 @@ input {
105108
106109 Exceptions are, for example, sections that configure different devices by name:
107110
108-```
111+<!-- no-test -->
112+```kdl
109113 output "eDP-1" {
110114 // ...
111115 }
wiki/Configuration:-Window-Rules.mdmodified+31 -31
@@ -7,7 +7,7 @@ Window rules are processed in order of appearance in the config file.
77 This means that you can put more generic rules first, then override them for specific windows later.
88 For example:
99
10-```
10+```kdl
1111 // Set open-maximized to true for all windows.
1212 window-rule {
1313 open-maximized true
@@ -26,7 +26,7 @@ window-rule {
2626
2727 Here are all matchers and properties that a window rule could have:
2828
29-```
29+```kdl
3030 window-rule {
3131 match title="Firefox"
3232 match app-id="Alacritty"
@@ -77,7 +77,7 @@ window-rule {
7777 Each window rule can have several `match` and `exclude` directives.
7878 In order for the rule to apply, a window needs to match *any* of the `match` directives, and *none* of the `exclude` directives.
7979
80-```
80+```kdl
8181 window-rule {
8282 // Match all Telegram windows...
8383 match app-id=r#"^org\.telegram\.desktop$"#
@@ -93,7 +93,7 @@ window-rule {
9393 Match and exclude directives have the same syntax.
9494 There can be multiple *matchers* in one directive, then the window should match all of them for the directive to apply.
9595
96-```
96+```kdl
9797 window-rule {
9898 // Match Firefox windows with Gmail in title.
9999 match app-id="org.mozilla.firefox" title="Gmail"
@@ -121,7 +121,7 @@ Let's look at the matchers in more detail.
121121 These are regular expressions that should match anywhere in the window title and app ID respectively.
122122 You can read about the supported regular expression syntax [here](https://docs.rs/regex/latest/regex/#syntax).
123123
124-```
124+```kdl
125125 // Match windows with title containing "Mozilla Firefox",
126126 // or windows with app ID containing "Alacritty".
127127 window-rule {
@@ -132,7 +132,7 @@ window-rule {
132132
133133 Raw KDL strings can be helpful for writing out regular expressions:
134134
135-```
135+```kdl
136136 window-rule {
137137 exclude app-id=r#"^org\.keepassxc\.KeePassXC$"#
138138 }
@@ -157,7 +157,7 @@ Matches active windows (same windows that have the active border / focus ring co
157157 Every workspace on the focused monitor will have one active window.
158158 This means that you will usually have multiple active windows (one per workspace), and when you switch between workspaces, you can see two active windows at once.
159159
160-```
160+```kdl
161161 window-rule {
162162 match is-active=true
163163 }
@@ -172,7 +172,7 @@ Contrary to `is-active`, there can only be a single focused window.
172172 Also, when opening a layer-shell application launcher or pop-up menu, the keyboard focus goes to layer-shell.
173173 While layer-shell has the keyboard focus, windows will not match this rule.
174174
175-```
175+```kdl
176176 window-rule {
177177 match is-focused=true
178178 }
@@ -188,7 +188,7 @@ Matches the window that is the "active" window in its column.
188188 Contrary to `is-active`, there is always one `is-active-in-column` window in each column.
189189 It is the window that was last focused in the column, i.e. the one that will gain focus if this column is focused.
190190
191-```
191+```kdl
192192 window-rule {
193193 match is-active-in-column=true
194194 }
@@ -203,7 +203,7 @@ Matches during the first 60 seconds after starting niri.
203203
204204 This is useful for properties like `open-on-output` which you may want to apply only right after starting niri.
205205
206-```
206+```kdl
207207 // Open windows on the HDMI-A-1 monitor at niri startup, but not afterwards.
208208 window-rule {
209209 match at-startup=true
@@ -221,7 +221,7 @@ To be precise, they apply at the point when niri sends the initial configure req
221221
222222 Set the default width for the new window.
223223
224-```
224+```kdl
225225 // Give Blender and GIMP some guaranteed width on opening.
226226 window-rule {
227227 match app-id="^blender$"
@@ -242,7 +242,7 @@ If such an output does not exist, the window will open on the currently focused
242242
243243 If the window opens on an output that is not currently focused, the window will not be automatically focused.
244244
245-```
245+```kdl
246246 // Open Firefox and Telegram (but not its Media Viewer)
247247 // on a specific monitor.
248248 window-rule {
@@ -264,7 +264,7 @@ If such a workspace does not exist, the window will open on the currently focuse
264264
265265 If the window opens on an output that is not currently focused, the window will not be automatically focused.
266266
267-```
267+```kdl
268268 // Open Fractal on the "chat" workspace.
269269 window-rule {
270270 match app-id=r#"^org\.gnome\.Fractal$"#
@@ -277,7 +277,7 @@ window-rule {
277277
278278 Make the window open as a maximized column.
279279
280-```
280+```kdl
281281 // Maximize Firefox by default.
282282 window-rule {
283283 match app-id=r#"^org\.mozilla\.firefox$"#
@@ -290,7 +290,7 @@ window-rule {
290290
291291 Make the window open fullscreen.
292292
293-```
293+```kdl
294294 window-rule {
295295 open-fullscreen true
296296 }
@@ -298,7 +298,7 @@ window-rule {
298298
299299 You can also set this to `false` to *prevent* a window from opening fullscreen.
300300
301-```
301+```kdl
302302 // Make the Telegram media viewer open in windowed mode.
303303 window-rule {
304304 match app-id=r#"^org\.telegram\.desktop$"# title="^Media viewer$"
@@ -329,7 +329,7 @@ To preview and set up this rule, check the `preview-render` option in the debug
329329 The built-in screenshot UI is not affected by this problem though.
330330 If you open the screenshot UI while screencasting, you will be able to select the area to screenshot while seeing all windows normally, but on a screencast the selection UI will display with windows blocked out.
331331
332-```
332+```kdl
333333 // Block out password managers from screencasts.
334334 window-rule {
335335 match app-id=r#"^org\.keepassxc\.KeePassXC$"#
@@ -345,7 +345,7 @@ This way you avoid accidentally showing the window on a screencast when opening
345345 This setting will still let you use the interactive built-in screenshot UI, but it will block out the window from the fully automatic screenshot actions, such as `screenshot-screen` and `screenshot-window`.
346346 The reasoning is that with an interactive selection, you can make sure that you avoid screenshotting sensitive content.
347347
348-```
348+```kdl
349349 window-rule {
350350 block-out-from "screen-capture"
351351 }
@@ -356,11 +356,11 @@ window-rule {
356356 >
357357 > For example, you might try to block out specific Firefox tabs like this:
358358 >
359-> ```
359+> ```kdl
360360 > window-rule {
361361 > // Doesn't quite work! Try to block out the Gmail tab.
362362 > match app-id=r#"^org\.mozilla\.firefox$"# title="- Gmail "
363->
363+>
364364 > block-out-from "screencast"
365365 > }
366366 > ```
@@ -382,7 +382,7 @@ Opacity is applied to every surface of the window individually, so subsurfaces a
382382
383383 Also, focus ring and border with background will show through semitransparent windows (see `prefer-no-csd` and the `draw-border-with-background` window rule below).
384384
385-```
385+```kdl
386386 // Make inactive windows semitransparent.
387387 window-rule {
388388 match is-active=false
@@ -400,11 +400,11 @@ Set this to `false` to draw them as borders around the window even for windows w
400400
401401 This property can be useful for rectangular windows that do not support the xdg-decoration protocol.
402402
403-| With Background | Without Background |
404-| --------------- | ------------------ |
403+| With Background | Without Background |
404+| ------------------------------------------------ | --------------------------------------------------- |
405405 | ![](./img/simple-egl-border-with-background.png) | ![](./img/simple-egl-border-without-background.png) |
406406
407-```
407+```kdl
408408 window-rule {
409409 draw-border-with-background false
410410 }
@@ -421,7 +421,7 @@ These rules have the same options as the normal focus ring and border config in
421421 However, in addition to `off` to disable the border/focus ring, this window rule has an `on` flag that enables the border/focus ring for the window even if it was otherwise disabled.
422422 The `on` flag has precedence over the `off` flag, in case both are set.
423423
424-```
424+```kdl
425425 window-rule {
426426 focus-ring {
427427 off
@@ -446,7 +446,7 @@ Set the corner radius of the window.
446446 On its own, this setting will only affect the border and the focus ring—they will round their corners to match the geometry corner radius.
447447 If you'd like to force-round the corners of the window itself, set `clip-to-geometry true` in addition to this setting.
448448
449-```
449+```kdl
450450 window-rule {
451451 geometry-corner-radius 12
452452 }
@@ -459,7 +459,7 @@ The radius is set in logical pixels, and controls the radius of the window itsel
459459 Instead of one radius, you can set four, for each corner.
460460 The order is the same as in CSS: top-left, top-right, bottom-right, bottom-left.
461461
462-```
462+```kdl
463463 window-rule {
464464 geometry-corner-radius 8 8 0 0
465465 }
@@ -479,7 +479,7 @@ This will cut out any client-side window shadows, and also round window corners
479479
480480 ![](./img/clip-to-geometry.png)
481481
482-```
482+```kdl
483483 window-rule {
484484 clip-to-geometry true
485485 }
@@ -489,7 +489,7 @@ Enable border, set `geometry-corner-radius` and `clip-to-geometry`, and you've g
489489
490490 ![](./img/border-radius-clip.png)
491491
492-```
492+```kdl
493493 prefer-no-csd
494494
495495 layout {
@@ -521,7 +521,7 @@ These values instruct niri to never ask the window to be smaller than the minimu
521521 >
522522 > This is a limitation of niri's window height distribution algorithm.
523523
524-```
524+```kdl
525525 window-rule {
526526 min-width 100
527527 max-width 200
@@ -530,7 +530,7 @@ window-rule {
530530 }
531531 ```
532532
533-```
533+```kdl
534534 // Fix OBS with server-side decorations missing a minimum width.
535535 window-rule {
536536 match app-id=r#"^com\.obsproject\.Studio$"#