diff options
| author | Ivan Molodetskikh <yalterz@gmail.com> | 2023-11-02 09:39:37 +0400 |
|---|---|---|
| committer | Ivan Molodetskikh <yalterz@gmail.com> | 2023-11-02 09:39:37 +0400 |
| commit | 7ff91fe39423c9ffbef5da9644d5567b3a3c07c4 (patch) | |
| tree | 0111c28cb95d095455f7637b827165b223b6075d | |
| parent | e7857efbd2a86e261d988ec62f73dd26d72e7a9c (diff) | |
| download | niri-7ff91fe39423c9ffbef5da9644d5567b3a3c07c4.tar.gz niri-7ff91fe39423c9ffbef5da9644d5567b3a3c07c4.tar.bz2 niri-7ff91fe39423c9ffbef5da9644d5567b3a3c07c4.zip | |
Add a check for primary monitor workspace invariant
| -rw-r--r-- | src/layout.rs | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/src/layout.rs b/src/layout.rs index 866e39ce..5426af95 100644 --- a/src/layout.rs +++ b/src/layout.rs @@ -1066,13 +1066,27 @@ impl<W: LayoutElement> Layout<W> { let monitor_id = OutputId::new(&monitor.output); if idx == primary_idx { + for ws in &monitor.workspaces { + if ws.original_output == monitor_id { + // This is the primary monitor's own workspace. + continue; + } + + let own_monitor_exists = monitors + .iter() + .any(|m| OutputId::new(&m.output) == ws.original_output); + assert!( + !own_monitor_exists, + "primary monitor cannot have workspaces for which their own monitor exists" + ); + } } else { assert!( monitor .workspaces .iter() .any(|workspace| workspace.original_output == monitor_id), - "secondary monitor must have all own workspaces" + "secondary monitor must not have any non-own workspaces" ); } |
