From cba73be1a45b4affb66d31d0bc81fc04e62ff3f2 Mon Sep 17 00:00:00 2001 From: Victoria Brekenfeld Date: Fri, 13 Dec 2024 17:48:42 +0100 Subject: [PATCH] shell: Fix stacking maximized windows --- src/shell/mod.rs | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/shell/mod.rs b/src/shell/mod.rs index 28b87e61..e9022c67 100644 --- a/src/shell/mod.rs +++ b/src/shell/mod.rs @@ -3501,7 +3501,12 @@ impl Shell { let workspace = &mut set.workspaces[set.active]; let maybe_window = workspace.focus_stack.get(seat).iter().next().cloned(); if let Some(window) = maybe_window { - if set.sticky_layer.mapped().any(|m| m == &window) { + let was_maximized = window.is_maximized(false); + if was_maximized { + workspace.unmaximize_request(&window); + } + + let res = if set.sticky_layer.mapped().any(|m| m == &window) { set.sticky_layer .toggle_stacking_focused(seat, workspace.focus_stack.get_mut(seat)) } else if workspace.tiling_layer.mapped().any(|(m, _)| m == &window) { @@ -3514,7 +3519,15 @@ impl Shell { .toggle_stacking_focused(seat, workspace.focus_stack.get_mut(seat)) } else { None + }; + + if was_maximized { + if let Some(KeyboardFocusTarget::Element(mapped)) = res.as_ref() { + self.maximize_request(mapped, seat); + } } + + res } else { None }