forge
Explore
Log in

Don't you dare go Hollow

4f421907cd554f58a4426f4788c538be450b3cd6Ivan MolodetskikhParent: b4eaaed
resources/default-config.kdlmodified+29 -32
@@ -80,6 +80,35 @@ input {
80 }80 }
81 81
82 layout {82 layout {
83+ // Set gaps around windows in logical pixels.
84+ gaps 16
85+
86+ // When to center a column when changing focus, options are:
87+ // - "never", default behavior, focusing an off-screen column will keep at the left
88+ // or right edge of the screen.
89+ // - "always", the focused column will always be centered.
90+ // - "on-overflow", focusing a column will center it if it doesn't fit
91+ // together with the previously focused column.
92+ center-focused-column "never"
93+
94+ // You can customize the widths that "switch-preset-column-width" (Mod+R) toggles between.
95+ preset-column-widths {
96+ // Proportion sets the width as a fraction of the output width, taking gaps into account.
97+ // For example, you can perfectly fit four windows sized "proportion 0.25" on an output.
98+ // The default preset widths are 1/3, 1/2 and 2/3 of the output.
99+ proportion 0.33333
100+ proportion 0.5
101+ proportion 0.66667
102+
103+ // Fixed sets the width in logical pixels exactly.
104+ // fixed 1920
105+ }
106+
107+ // You can change the default width of the new windows.
108+ default-column-width { proportion 0.5; }
109+ // If you leave the brackets empty, the windows themselves will decide their initial width.
110+ // default-column-width {}
111+
83 // By default focus ring and border are rendered as a solid background rectangle112 // By default focus ring and border are rendered as a solid background rectangle
84 // behind windows. That is, they will show up through semitransparent windows.113 // behind windows. That is, they will show up through semitransparent windows.
85 // This is because windows using client-side decorations can have an arbitrary shape.114 // This is because windows using client-side decorations can have an arbitrary shape.
@@ -110,9 +139,6 @@ layout {
110 // Color of the ring on inactive monitors.139 // Color of the ring on inactive monitors.
111 inactive-color "#505050"140 inactive-color "#505050"
112 141
113- // Additionally, there's a legacy RGBA syntax:
114- // active-color 127 200 255 255
115-
116 // You can also use gradients. They take precedence over solid colors.142 // You can also use gradients. They take precedence over solid colors.
117 // Gradients are rendered the same as CSS linear-gradient(angle, from, to).143 // Gradients are rendered the same as CSS linear-gradient(angle, from, to).
118 // The angle is the same as in linear-gradient, and is optional,144 // The angle is the same as in linear-gradient, and is optional,
@@ -142,27 +168,6 @@ layout {
142 // inactive-gradient from="#505050" to="#808080" angle=45 relative-to="workspace-view"168 // inactive-gradient from="#505050" to="#808080" angle=45 relative-to="workspace-view"
143 }169 }
144 170
145- // You can customize the widths that "switch-preset-column-width" (Mod+R) toggles between.
146- preset-column-widths {
147- // Proportion sets the width as a fraction of the output width, taking gaps into account.
148- // For example, you can perfectly fit four windows sized "proportion 0.25" on an output.
149- // The default preset widths are 1/3, 1/2 and 2/3 of the output.
150- proportion 0.33333
151- proportion 0.5
152- proportion 0.66667
153-
154- // Fixed sets the width in logical pixels exactly.
155- // fixed 1920
156- }
157-
158- // You can change the default width of the new windows.
159- default-column-width { proportion 0.5; }
160- // If you leave the brackets empty, the windows themselves will decide their initial width.
161- // default-column-width {}
162-
163- // Set gaps around windows in logical pixels.
164- gaps 16
165-
166 // Struts shrink the area occupied by windows, similarly to layer-shell panels.171 // Struts shrink the area occupied by windows, similarly to layer-shell panels.
167 // You can think of them as a kind of outer gaps. They are set in logical pixels.172 // You can think of them as a kind of outer gaps. They are set in logical pixels.
168 // Left and right struts will cause the next window to the side to always be visible.173 // Left and right struts will cause the next window to the side to always be visible.
@@ -174,14 +179,6 @@ layout {
174 // top 64179 // top 64
175 // bottom 64180 // bottom 64
176 }181 }
177-
178- // When to center a column when changing focus, options are:
179- // - "never", default behavior, focusing an off-screen column will keep at the left
180- // or right edge of the screen.
181- // - "on-overflow", focusing a column will center it if it doesn't fit
182- // together with the previously focused column.
183- // - "always", the focused column will always be centered.
184- center-focused-column "never"
185 }182 }
186 183
187 // Add lines like this to spawn processes at startup.184 // Add lines like this to spawn processes at startup.
wiki/Configuration:-Layout.mdadded+234 -0
@@ -0,0 +1,234 @@
1+### Overview
2+
3+In the `layout {}` section you can change various settings that influence how the windows are positioned and sized.
4+
5+Here are the contents of this section at a glance:
6+
7+```
8+layout {
9+ gaps 16
10+ center-focused-column "never"
11+
12+ preset-column-widths {
13+ proportion 0.33333
14+ proportion 0.5
15+ proportion 0.66667
16+ }
17+
18+ default-column-width { proportion 0.5; }
19+
20+ focus-ring {
21+ // off
22+ width 4
23+ active-color "#7fc8ff"
24+ inactive-color "#505050"
25+ // active-gradient from="#80c8ff" to="#bbddff" angle=45
26+ // inactive-gradient from="#505050" to="#808080" angle=45 relative-to="workspace-view"
27+ }
28+
29+ border {
30+ off
31+ width 4
32+ active-color "#ffc87f"
33+ inactive-color "#505050"
34+ // active-gradient from="#ffbb66" to="#ffc880" angle=45 relative-to="workspace-view"
35+ // inactive-gradient from="#505050" to="#808080" angle=45 relative-to="workspace-view"
36+ }
37+
38+ struts {
39+ // left 64
40+ // right 64
41+ // top 64
42+ // bottom 64
43+ }
44+}
45+```
46+
47+### `gaps`
48+
49+Set gaps around (inside and outside) windows in logical pixels.
50+
51+```
52+layout {
53+ gaps 16
54+}
55+```
56+
57+### `center-focused-column`
58+
59+When to center a column when changing focus.
60+This can be set to:
61+
62+- `"never"`: no special centering, focusing an off-screen column will scroll it to the left or right edge of the screen. This is the default.
63+- `"always"`, the focused column will always be centered.
64+- `"on-overflow"`, focusing a column will center it if it doesn't fit on screen together with the previously focused column.
65+
66+```
67+layout {
68+ center-focused-column "always"
69+}
70+```
71+
72+### `preset-column-widths`
73+
74+Set the widths that the `switch-preset-column-width` action (Mod+R) toggles between.
75+
76+`proportion` sets the width as a fraction of the output width, taking gaps into account.
77+For example, you can perfectly fit four windows sized `proportion 0.25` on an output, regardless of the gaps setting.
78+The default preset widths are <sup>1</sup>&frasl;<sub>3</sub>, <sup>1</sup>&frasl;<sub>2</sub> and <sup>2</sup>&frasl;<sub>3</sub> of the output.
79+
80+`fixed` sets the width in logical pixels exactly.
81+
82+```
83+layout {
84+ // Cycle between 1/3, 1/2, 2/3 of the output, and a fixed 1280 logical pixels.
85+ preset-column-widths {
86+ proportion 0.33333
87+ proportion 0.5
88+ proportion 0.66667
89+ fixed 1280
90+ }
91+}
92+```
93+
94+### `default-column-width`
95+
96+Set the default width of the new windows.
97+
98+The syntax is the same as in `preset-column-widths` above.
99+
100+```
101+layout {
102+ // Open new windows sized 1/3 of the output.
103+ default-column-width { proportion 0.33333; }
104+}
105+```
106+
107+You can also leave the brackets empty, then the windows themselves will decide their initial width.
108+
109+```
110+layout {
111+ // New windows decide their initial width themselves.
112+ default-column-width {}
113+}
114+```
115+
116+> [!NOTE]
117+> `default-column-width {}` causes niri to send a (0, H) size in the initial configure request.
118+>
119+> This is a bit unclearly defined in the Wayland protocol, so some clients may misinterpret it.
120+> In practice, the only problematic client I saw is [foot](https://codeberg.org/dnkl/foot/), which takes this as a request to have a literal zero width.
121+>
122+> Either way, `default-column-width {}` is most useful for specific windows, in form of a [window rule](https://github.com/YaLTeR/niri/wiki/Configuration:-Window-Rules) with the same syntax.
123+
124+### `focus-ring` and `border`
125+
126+Focus ring and border are drawn around windows and indicate the active window.
127+They are very similar and have the same options.
128+
129+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).
130+
131+| Focus Ring | Border |
132+| ---------- | ------ |
133+| ![](./img/focus-ring.png) | ![](./img/border.png) |
134+
135+> [!TIP]
136+> By default focus ring and border are rendered as a solid background rectangle behind windows.
137+> That is, they will show up through semitransparent windows.
138+> This is because windows using client-side decorations can have an arbitrary shape.
139+>
140+> If you don't like that, you should uncomment the `prefer-no-csd` setting at the top level of the config.
141+> Then, niri will draw focus rings and borders *around* windows that agree to omit their client-side decorations.
142+>
143+> Alternatively, you can override this with the `draw-border-with-background` [window rule](https://github.com/YaLTeR/niri/wiki/Configuration:-Window-Rules).
144+
145+Focus ring and border have the following options.
146+
147+```
148+layout {
149+ // focus-ring has the same options.
150+ border {
151+ // Uncomment this line to disable the border.
152+ // off
153+
154+ // Width of the border in logical pixels.
155+ width 4
156+
157+ active-color "#ffc87f"
158+ inactive-color "#505050"
159+
160+ // active-gradient from="#ffbb66" to="#ffc880" angle=45 relative-to="workspace-view"
161+ // inactive-gradient from="#505050" to="#808080" angle=45 relative-to="workspace-view"
162+ }
163+}
164+```
165+
166+#### Colors
167+
168+Colors can be set in a variety of ways:
169+
170+- CSS named colors: `"red"`
171+- RGB hex: `"#rgb"`, `"#rgba"`, `"#rrggbb"`, `"#rrggbbaa"`
172+- CSS-like notation: `"rgb(255, 127, 0)"`, `"rgba()"`, `"hsl()"` and a few others.
173+
174+`active-color` is the color of the focus ring / border around the active window, and `inactive-color` is the color of the focus ring / border around all other windows.
175+
176+The *focus ring* is only drawn around the active window on each monitor, so with a single monitor you will never see its `inactive-color`.
177+You will see it if you have multiple monitors, though.
178+
179+There's also a *deprecated* syntax for setting colors with four numbers representing R, G, B and A: `active-color 127 200 255 255`.
180+
181+#### Gradients
182+
183+Similarly to colors, you can set `active-gradient` and `inactive-gradient`, which will take precedence.
184+
185+Gradients are rendered the same as CSS [`linear-gradient(angle, from, to)`](https://developer.mozilla.org/en-US/docs/Web/CSS/gradient/linear-gradient).
186+The angle works the same as in `linear-gradient`, and is optional, defaulting to `180` (top-to-bottom gradient).
187+You can use any CSS linear-gradient tool on the web to set these up, like [this one](https://www.css-gradient.com/).
188+
189+```
190+layout {
191+ focus-ring {
192+ active-gradient from="#80c8ff" to="#bbddff" angle=45
193+ }
194+}
195+```
196+
197+Gradients can be colored relative to windows individually (the default), or to the whole view of the workspace.
198+To do that, set `relative-to="workspace-view"`.
199+Here's a visual example:
200+
201+| Default | `relative-to="workspace-view"` |
202+| --- | --- |
203+| ![](./img/gradients-default.png) | ![](./img/gradients-relative-to-workspace-view.png) |
204+
205+```
206+layout {
207+ border {
208+ active-gradient from="#ffbb66" to="#ffc880" angle=45 relative-to="workspace-view"
209+ inactive-gradient from="#505050" to="#808080" angle=45 relative-to="workspace-view"
210+ }
211+}
212+```
213+
214+### `struts`
215+
216+Struts shrink the area occupied by windows, similarly to layer-shell panels.
217+You can think of them as a kind of outer gaps.
218+They are set in logical pixels.
219+
220+Left and right struts will cause the next window to the side to always peek out slightly.
221+Top and bottom struts will simply add outer gaps in addition to the area occupied by layer-shell panels and regular gaps.
222+
223+```
224+layout {
225+ struts {
226+ left 64
227+ right 64
228+ top 64
229+ bottom 64
230+ }
231+}
232+```
233+
234+![](./img/struts.png)
wiki/_Sidebar.mdmodified+1 -0
@@ -10,6 +10,7 @@
10 * [Input](./Configuration:-Input.md)10 * [Input](./Configuration:-Input.md)
11 * [Outputs](./Configuration:-Outputs.md)11 * [Outputs](./Configuration:-Outputs.md)
12 * [Key Bindings](./Configuration:-Key-Bindings.md)12 * [Key Bindings](./Configuration:-Key-Bindings.md)
13+* [Layout](./Configuration:-Layout.md)
13 * [Window Rules](./Configuration:-Window-Rules.md)14 * [Window Rules](./Configuration:-Window-Rules.md)
14 * [Animations](./Configuration:-Animations.md)15 * [Animations](./Configuration:-Animations.md)
15 * [Debug Options](./Configuration:-Debug-Options.md)16 * [Debug Options](./Configuration:-Debug-Options.md)
wiki/img/border.pngadded+3 -0
@@ -0,0 +1,3 @@
1+version https://git-lfs.github.com/spec/v1
2+oid sha256:bc0f46cdc5fc56a483f56a052b934b02f915f8b95cce3a9309e2ce7bf02478d4
3+size 2623
wiki/img/focus-ring.pngadded+3 -0
@@ -0,0 +1,3 @@
1+version https://git-lfs.github.com/spec/v1
2+oid sha256:ee21b6ed445f069270a6b0023a0c15659ac62cf7c92721792a3e3781148f2394
3+size 4608
wiki/img/gradients-default.pngadded+3 -0
@@ -0,0 +1,3 @@
1+version https://git-lfs.github.com/spec/v1
2+oid sha256:164e445914282dc0e6e345f0b76ae59b617dfb8db6cf0c8b05cae51ed7d51b97
3+size 31700
wiki/img/gradients-relative-to-workspace-view.pngadded+3 -0
@@ -0,0 +1,3 @@
1+version https://git-lfs.github.com/spec/v1
2+oid sha256:bb4e3e64bb0402b402b945b778c39b083512f7453d1503b789b63c8d6ff69330
3+size 29540
wiki/img/struts.pngadded+3 -0
@@ -0,0 +1,3 @@
1+version https://git-lfs.github.com/spec/v1
2+oid sha256:32e84ae4c14683d07da42bea96a66fbb3427b11ba7619a98d3dc73d77c9f999c
3+size 20959