From 09cf8402c3e25fbe4ab790cb997ae4033f9d30f3 Mon Sep 17 00:00:00 2001 From: Ivan Molodetskikh Date: Thu, 25 Sep 2025 18:15:46 +0300 Subject: Add per-output layout config --- src/layout/tests.rs | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) (limited to 'src/layout/tests.rs') diff --git a/src/layout/tests.rs b/src/layout/tests.rs index 7d51b751..389408c2 100644 --- a/src/layout/tests.rs +++ b/src/layout/tests.rs @@ -406,9 +406,17 @@ enum Op { id: usize, #[proptest(strategy = "arbitrary_scale()")] scale: f64, + #[proptest(strategy = "prop::option::of(arbitrary_layout_part().prop_map(Box::new))")] + layout_config: Option>, }, RemoveOutput(#[proptest(strategy = "1..=5usize")] usize), FocusOutput(#[proptest(strategy = "1..=5usize")] usize), + UpdateOutputLayoutConfig { + #[proptest(strategy = "1..=5usize")] + id: usize, + #[proptest(strategy = "prop::option::of(arbitrary_layout_part().prop_map(Box::new))")] + layout_config: Option>, + }, AddNamedWorkspace { #[proptest(strategy = "1..=5usize")] ws_name: usize, @@ -771,9 +779,13 @@ impl Op { model: None, serial: None, }); - layout.add_output(output.clone()); + layout.add_output(output.clone(), None); } - Op::AddScaledOutput { id, scale } => { + Op::AddScaledOutput { + id, + scale, + layout_config, + } => { let name = format!("output{id}"); if layout.outputs().any(|o| o.name() == name) { return; @@ -804,7 +816,7 @@ impl Op { model: None, serial: None, }); - layout.add_output(output.clone()); + layout.add_output(output.clone(), layout_config.map(|x| *x)); } Op::RemoveOutput(id) => { let name = format!("output{id}"); @@ -822,6 +834,14 @@ impl Op { layout.focus_output(&output); } + Op::UpdateOutputLayoutConfig { id, layout_config } => { + let name = format!("output{id}"); + let Some(mon) = layout.monitors_mut().find(|m| m.output_name() == &name) else { + return; + }; + + mon.update_layout_config(layout_config.map(|x| *x)); + } Op::AddNamedWorkspace { ws_name, output_name, -- cgit