fix(wm): prevent stack-all issues with n>1 stacks on ws

This commit ensures that unstack_all is called on a workspace before
attempting to proceed with stack_all to avoid stacking loops that can
occur when there are multiple pre-existing stacks already created on the
workspace.
This commit is contained in:
LGUG2Z
2025-06-04 15:51:03 -07:00
parent d4eeec994f
commit 98c5ab3b9b
2 changed files with 9 additions and 3 deletions

View File

@@ -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)?;
}

View File

@@ -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))]