diff --git a/komorebi/src/process_command.rs b/komorebi/src/process_command.rs index 13d41ca7..42a5f51a 100644 --- a/komorebi/src/process_command.rs +++ b/komorebi/src/process_command.rs @@ -349,7 +349,7 @@ impl WindowManager { SocketMessage::StackWindow(direction) => self.add_window_to_container(direction)?, SocketMessage::UnstackWindow => self.remove_window_from_container()?, SocketMessage::StackAll => self.stack_all()?, - SocketMessage::UnstackAll => self.unstack_all()?, + SocketMessage::UnstackAll => self.unstack_all(true)?, SocketMessage::CycleStack(direction) => { self.cycle_container_window_in_direction(direction)?; } diff --git a/komorebi/src/window_manager.rs b/komorebi/src/window_manager.rs index 4b7d71dc..4ea65707 100644 --- a/komorebi/src/window_manager.rs +++ b/komorebi/src/window_manager.rs @@ -2960,6 +2960,8 @@ impl WindowManager { #[tracing::instrument(skip(self))] pub fn stack_all(&mut self) -> Result<()> { + self.unstack_all(false)?; + self.handle_unmanaged_window_behaviour()?; tracing::info!("stacking all windows on workspace"); @@ -2986,7 +2988,7 @@ impl WindowManager { } #[tracing::instrument(skip(self))] - pub fn unstack_all(&mut self) -> Result<()> { + pub fn unstack_all(&mut self, update_workspace: bool) -> Result<()> { self.handle_unmanaged_window_behaviour()?; tracing::info!("unstacking all windows in container"); @@ -3016,7 +3018,11 @@ impl WindowManager { workspace.focus_container_by_window(hwnd)?; } - self.update_focused_workspace(self.mouse_follows_focus, true) + if update_workspace { + self.update_focused_workspace(self.mouse_follows_focus, true)?; + } + + Ok(()) } #[tracing::instrument(skip(self))]