aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIvan Molodetskikh <yalterz@gmail.com>2023-10-14 20:39:44 +0400
committerIvan Molodetskikh <yalterz@gmail.com>2023-10-14 20:42:44 +0400
commit736191e826eba3d2a75f7e5949a6ecd0a8b6bb5a (patch)
treeb2062a1bbbc137ebb7a63ae2790d91e0e7244ef1
parentd1f431fd7e94ac76cd0a6f47368b376d639a6d71 (diff)
downloadniri-736191e826eba3d2a75f7e5949a6ecd0a8b6bb5a.tar.gz
niri-736191e826eba3d2a75f7e5949a6ecd0a8b6bb5a.tar.bz2
niri-736191e826eba3d2a75f7e5949a6ecd0a8b6bb5a.zip
Add check for no empty workspaces invariant
-rw-r--r--src/layout.rs13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/layout.rs b/src/layout.rs
index f94bf7da..99a6cd93 100644
--- a/src/layout.rs
+++ b/src/layout.rs
@@ -1084,6 +1084,19 @@ impl<W: LayoutElement> Layout<W> {
"monitor must have an empty workspace in the end"
);
+ // If there's no workspace switch in progress, there can't be any non-last non-active
+ // empty workspaces.
+ if monitor.workspace_switch.is_none() {
+ for (idx, ws) in monitor.workspaces.iter().enumerate().rev().skip(1) {
+ if idx != monitor.active_workspace_idx {
+ assert!(
+ !ws.columns.is_empty(),
+ "non-active workspace can't be empty except the last one"
+ );
+ }
+ }
+ }
+
// FIXME: verify that primary doesn't have any workspaces for which their own monitor
// exists.