forge
Explore
Log in

Don't you dare go Hollow

wiki: Add outputs section

Browse files at this commit

62f14d42dce66eaa949f84f06d2de21e5c688e9dIvan MolodetskikhParent: ce64485
resources/default-config.kdlmodified+11 -9
@@ -45,18 +45,13 @@ input {
45 // You can configure outputs by their name, which you can find45 // You can configure outputs by their name, which you can find
46 // by running `niri msg outputs` while inside a niri instance.46 // by running `niri msg outputs` while inside a niri instance.
47 // The built-in laptop monitor is usually called "eDP-1".47 // The built-in laptop monitor is usually called "eDP-1".
48+// Find more information on the wiki:
49+// https://github.com/YaLTeR/niri/wiki/Configuration:-Outputs
48 // Remember to uncomment the node by removing "/-"!50 // Remember to uncomment the node by removing "/-"!
49 /-output "eDP-1" {51 /-output "eDP-1" {
50 // Uncomment this line to disable this output.52 // Uncomment this line to disable this output.
51 // off53 // off
52 54
53- // Scale is a floating-point number, but at the moment only integer values work.
54- scale 2.0
55-
56- // Transform allows to rotate the output counter-clockwise, valid values are:
57- // normal, 90, 180, 270, flipped, flipped-90, flipped-180 and flipped-270.
58- transform "normal"
59-
60 // Resolution and, optionally, refresh rate of the output.55 // Resolution and, optionally, refresh rate of the output.
61 // The format is "<width>x<height>" or "<width>x<height>@<refresh rate>".56 // The format is "<width>x<height>" or "<width>x<height>@<refresh rate>".
62 // If the refresh rate is omitted, niri will pick the highest refresh rate57 // If the refresh rate is omitted, niri will pick the highest refresh rate
@@ -65,14 +60,21 @@ input {
65 // Run `niri msg outputs` while inside a niri instance to list all outputs and their modes.60 // Run `niri msg outputs` while inside a niri instance to list all outputs and their modes.
66 mode "1920x1080@120.030"61 mode "1920x1080@120.030"
67 62
63+ // Scale is a floating-point number, but at the moment only integer values work.
64+ scale 2.0
65+
66+ // Transform allows to rotate the output counter-clockwise, valid values are:
67+ // normal, 90, 180, 270, flipped, flipped-90, flipped-180 and flipped-270.
68+ transform "normal"
69+
68 // Position of the output in the global coordinate space.70 // Position of the output in the global coordinate space.
69 // This affects directional monitor actions like "focus-monitor-left", and cursor movement.71 // This affects directional monitor actions like "focus-monitor-left", and cursor movement.
70 // The cursor can only move between directly adjacent outputs.72 // The cursor can only move between directly adjacent outputs.
71- // Output scale has to be taken into account for positioning:73+ // Output scale and rotation has to be taken into account for positioning:
72 // outputs are sized in logical, or scaled, pixels.74 // outputs are sized in logical, or scaled, pixels.
73 // For example, a 3840×2160 output with scale 2.0 will have a logical size of 1920×1080,75 // For example, a 3840×2160 output with scale 2.0 will have a logical size of 1920×1080,
74 // so to put another output directly adjacent to it on the right, set its x to 1920.76 // so to put another output directly adjacent to it on the right, set its x to 1920.
75- // It the position is unset or results in an overlap, the output is instead placed77+ // If the position is unset or results in an overlap, the output is instead placed
76 // automatically.78 // automatically.
77 position x=1280 y=079 position x=1280 y=0
78 }80 }
wiki/Configuration:-Outputs.mdadded+114 -0
@@ -0,0 +1,114 @@
1+### Overview
2+
3+By default, niri will attempt to turn on all connected monitors using their preferred modes.
4+You can disable or adjust this with `output` sections.
5+
6+Here's what it looks like with all properties written out:
7+
8+```
9+output "eDP-1" {
10+ // off
11+ scale 2.0
12+ mode "1920x1080@120.030"
13+ position x=1280 y=0
14+ transform "90"
15+}
16+
17+output "HDMI-A-1" {
18+ // ...settings for HDMI-A-1...
19+}
20+```
21+
22+Outputs are matched by connector name (i.e. `eDP-1`, `HDMI-A-1`) which you can find by running `niri msg outputs`.
23+Usually, the built-in monitor in laptops will be called `eDP-1`.
24+Matching by output manufacturer and model is planned, but blocked on Smithay adopting libdisplay-info instead of edid-rs.
25+
26+### `off`
27+
28+This flag turns off that output entirely.
29+
30+```
31+// Turn off that monitor.
32+output "HDMI-A-1" {
33+ off
34+}
35+```
36+
37+### `mode`
38+
39+Set the monitor resolution and refresh rate.
40+
41+The format is `<width>x<height>` or `<width>x<height>@<refresh rate>`.
42+If the refresh rate is omitted, niri will pick the highest refresh rate for the resolution.
43+
44+If the mode is omitted altogether or doesn't work, niri will try to pick one automatically.
45+
46+Run `niri msg outputs` while inside a niri instance to list all outputs and their modes.
47+
48+```
49+// Set a high refresh rate for this monitor.
50+// High refresh rate monitors tend to use 60 Hz as their preferred mode,
51+// requiring a manual mode setting.
52+output "HDMI-A-1" {
53+ mode "2560x1440@143.912"
54+}
55+
56+// Use a lower resolution on the built-in laptop monitor
57+// (for example, for testing purposes).
58+output "eDP-1" {
59+ mode "1280x720"
60+}
61+```
62+
63+### `scale`
64+
65+Set the scale of the monitor.
66+
67+This is a floating-point number to enable fractional scaling in the future, but at the moment only integer scale values will work.
68+
69+```
70+output "eDP-1" {
71+ scale 2.0
72+}
73+```
74+
75+### `transform`
76+
77+Rotate the output counter-clockwise.
78+
79+Valid values are: `"normal"`, `"90"`, `"180"`, `"270"`, `"flipped"`, `"flipped-90"`, `"flipped-180"` and `"flipped-270"`.
80+Values with `flipped` additionally flip the output.
81+
82+```
83+output "HDMI-A-1" {
84+ transform "90"
85+}
86+```
87+
88+### `position`
89+
90+Set the position of the output in the global coordinate space.
91+
92+This affects directional monitor actions like `focus-monitor-left`, and cursor movement.
93+The cursor can only move between directly adjacent outputs.
94+
95+> [!NOTE]
96+> Output scale and rotation has to be taken into account for positioning: outputs are sized in logical, or scaled, pixels.
97+> 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.
98+> If the position is unset or results in an overlap, the output is instead placed automatically.
99+
100+```
101+output "HDMI-A-1" {
102+ position x=1280 y=0
103+}
104+```
105+
106+#### Automatic Positioning
107+
108+Niri repositions outputs from scratch every time the output configuration changes (which includes monitors disconnecting and connecting).
109+The following algorithm is used for positioning outputs.
110+
111+1. Collect all connected monitors and their logical sizes.
112+1. Sort them by their name. This makes it so the automatic positioning does not depend on the order the monitors are connected. This is important because the connection order is non-deterministic at compositor startup.
113+1. Try to place every output with explicitly configured `position`, in order. If the output overlaps previously placed outputs, place it to the right of all previously placed outputs. In this case, niri will also print a warning.
114+1. Place every output without explicitly configured `position` by putting it to the right of all previously placed outputs.
wiki/_Sidebar.mdmodified+1 -0
@@ -8,6 +8,7 @@
8 ## Configuration8 ## Configuration
9 * [Overview](./Configuration:-Overview.md)9 * [Overview](./Configuration:-Overview.md)
10 * [Input](./Configuration:-Input.md)10 * [Input](./Configuration:-Input.md)
11+* [Outputs](./Configuration:-Outputs.md)
11 * [Window Rules](./Configuration:-Window-Rules.md)12 * [Window Rules](./Configuration:-Window-Rules.md)
12 * [Animations](./Configuration:-Animations.md)13 * [Animations](./Configuration:-Animations.md)
13 * [Debug Options](./Configuration:-Debug-Options.md)14 * [Debug Options](./Configuration:-Debug-Options.md)