aboutsummaryrefslogtreecommitdiff
path: root/niri-config/src/lib.rs
diff options
context:
space:
mode:
authorMerlijn <32853531+ToxicMushroom@users.noreply.github.com>2025-10-29 07:10:38 +0100
committerGitHub <noreply@github.com>2025-10-29 09:10:38 +0300
commit6a2c6261df130cccb5262eddf71d40b2fffcf8f9 (patch)
tree48639aef4ebddbc315234b925954c5cc768d0f1c /niri-config/src/lib.rs
parente6f3c538da0c646bda43fcde7ef7dc3b771e0c8b (diff)
downloadniri-6a2c6261df130cccb5262eddf71d40b2fffcf8f9.tar.gz
niri-6a2c6261df130cccb5262eddf71d40b2fffcf8f9.tar.bz2
niri-6a2c6261df130cccb5262eddf71d40b2fffcf8f9.zip
Add support for custom modes and modelines. (#2479)
* Implement custom modes and modelines Co-authored-by: ToxicMushroom <32853531+ToxicMushroom@users.noreply.github.com> * fixes * refactor mode and modeline kdl parsers. * add IPC parse checks * refactor: address feedback * fix: add missing > 0 refresh rate check * move things around * fixes * wiki fixes --------- Co-authored-by: Christian Meissl <meissl.christian@gmail.com> Co-authored-by: Ivan Molodetskikh <yalterz@gmail.com>
Diffstat (limited to 'niri-config/src/lib.rs')
-rw-r--r--niri-config/src/lib.rs79
1 files changed, 73 insertions, 6 deletions
diff --git a/niri-config/src/lib.rs b/niri-config/src/lib.rs
index e939f0c3..dda7dfd6 100644
--- a/niri-config/src/lib.rs
+++ b/niri-config/src/lib.rs
@@ -663,6 +663,14 @@ mod tests {
}
}
+ output "eDP-2" {
+ mode custom=true "1920x1080@144"
+ }
+
+ output "eDP-3" {
+ modeline 173.00 1920 2048 2248 2576 1080 1083 1088 1120 "-hsync" "+vsync"
+ }
+
layout {
focus-ring {
width 5
@@ -1035,14 +1043,18 @@ mod tests {
},
),
mode: Some(
- ConfiguredMode {
- width: 1920,
- height: 1080,
- refresh: Some(
- 144.0,
- ),
+ Mode {
+ custom: false,
+ mode: ConfiguredMode {
+ width: 1920,
+ height: 1080,
+ refresh: Some(
+ 144.0,
+ ),
+ },
},
),
+ modeline: None,
variable_refresh_rate: Some(
Vrr {
on_demand: true,
@@ -1069,6 +1081,61 @@ mod tests {
),
layout: None,
},
+ Output {
+ off: false,
+ name: "eDP-2",
+ scale: None,
+ transform: Normal,
+ position: None,
+ mode: Some(
+ Mode {
+ custom: true,
+ mode: ConfiguredMode {
+ width: 1920,
+ height: 1080,
+ refresh: Some(
+ 144.0,
+ ),
+ },
+ },
+ ),
+ modeline: None,
+ variable_refresh_rate: None,
+ focus_at_startup: false,
+ background_color: None,
+ backdrop_color: None,
+ hot_corners: None,
+ layout: None,
+ },
+ Output {
+ off: false,
+ name: "eDP-3",
+ scale: None,
+ transform: Normal,
+ position: None,
+ mode: None,
+ modeline: Some(
+ Modeline {
+ clock: 173.0,
+ hdisplay: 1920,
+ hsync_start: 2048,
+ hsync_end: 2248,
+ htotal: 2576,
+ vdisplay: 1080,
+ vsync_start: 1083,
+ vsync_end: 1088,
+ vtotal: 1120,
+ hsync_polarity: NHSync,
+ vsync_polarity: PVSync,
+ },
+ ),
+ variable_refresh_rate: None,
+ focus_at_startup: false,
+ background_color: None,
+ backdrop_color: None,
+ hot_corners: None,
+ layout: None,
+ },
],
),
spawn_at_startup: [