From 815fa379ea1ba2ed9c9efff94e0b48374185f5de Mon Sep 17 00:00:00 2001 From: Ivan Molodetskikh Date: Wed, 27 Nov 2024 20:49:07 +0300 Subject: layout: Stop workspace switch when moving workspaces to primary Okay, this might be one of the oldest layout issues to have remained uncaught. Well, maybe as I add more randomized tests, I'll catch even more of those. --- src/layout/mod.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src') diff --git a/src/layout/mod.rs b/src/layout/mod.rs index cf61e87a..596079e0 100644 --- a/src/layout/mod.rs +++ b/src/layout/mod.rs @@ -634,6 +634,14 @@ impl Layout { ws.set_output(Some(primary.output.clone())); } + let mut stopped_primary_ws_switch = false; + if !workspaces.is_empty() && primary.workspace_switch.is_some() { + // FIXME: if we're adding workspaces to currently invisible positions + // (outside the workspace switch), we don't need to cancel it. + primary.workspace_switch = None; + stopped_primary_ws_switch = true; + } + let empty_was_focused = primary.active_workspace_idx == primary.workspaces.len() - 1; @@ -648,6 +656,10 @@ impl Layout { primary.active_workspace_idx = primary.workspaces.len() - 1; } + if stopped_primary_ws_switch { + primary.clean_up_workspaces(); + } + MonitorSet::Normal { monitors, primary_idx, -- cgit