forge
Explore
Log in

Don't you dare go Hollow

Add check for no empty workspaces invariant

Browse files at this commit

736191e826eba3d2a75f7e5949a6ecd0a8b6bb5aIvan MolodetskikhParent: d1f431f
src/layout.rsmodified+13 -0
@@ -1084,6 +1084,19 @@ impl<W: LayoutElement> Layout<W> {
1084 "monitor must have an empty workspace in the end"1084 "monitor must have an empty workspace in the end"
1085 );1085 );
1086 1086
1087+ // If there's no workspace switch in progress, there can't be any non-last non-active
1088+ // empty workspaces.
1089+ if monitor.workspace_switch.is_none() {
1090+ for (idx, ws) in monitor.workspaces.iter().enumerate().rev().skip(1) {
1091+ if idx != monitor.active_workspace_idx {
1092+ assert!(
1093+ !ws.columns.is_empty(),
1094+ "non-active workspace can't be empty except the last one"
1095+ );
1096+ }
1097+ }
1098+ }
1099+
1087 // FIXME: verify that primary doesn't have any workspaces for which their own monitor1100 // FIXME: verify that primary doesn't have any workspaces for which their own monitor
1088 // exists.1101 // exists.
1089 1102