From 400a7752fdc4a95c7f9c62ea7efff1c85f2446e8 Mon Sep 17 00:00:00 2001 From: Ian Douglas Scott Date: Fri, 11 Oct 2024 12:33:09 -0700 Subject: [PATCH] When moving workspaces on output remove, don't movve empty workspace This resulted in a somewhat weird effect, where the empty workspace at the end on the monitor has an `output_stack` with the other output, so a window created there is moved back to to second output when it is re-connected. This seems unexpected. --- src/shell/mod.rs | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/shell/mod.rs b/src/shell/mod.rs index 46136077..39c62e2e 100644 --- a/src/shell/mod.rs +++ b/src/shell/mod.rs @@ -729,13 +729,17 @@ impl Workspaces { let new_set = self.sets.get_mut(&new_output).unwrap(); let workspace_group = new_set.group; for mut workspace in set.workspaces.into_iter() { - // update workspace protocol state - move_workspace_to_group(&mut workspace, &workspace_group, workspace_state); + if workspace.is_empty() { + workspace_state.remove_workspace(workspace.handle); + } else { + // update workspace protocol state + move_workspace_to_group(&mut workspace, &workspace_group, workspace_state); - // update mapping - workspace.set_output(&new_output); - workspace.refresh(xdg_activation_state); - new_set.workspaces.push(workspace); + // update mapping + workspace.set_output(&new_output); + workspace.refresh(xdg_activation_state); + new_set.workspaces.push(workspace); + } } for window in set.sticky_layer.mapped() {