fix(wm): focus correct window if monocled stack

Previously if we had a stack on a monocle container and tried to cycle
stack or move the window within the stack or even using the focus stack
window from a bar it would focus the wrong window and temporarely show
that wrong window. This commit fixes this.
This commit is contained in:
alex-ds13
2025-03-10 12:03:46 +00:00
committed by Jeezy
parent acf780767c
commit ea9752d5e1
2 changed files with 12 additions and 3 deletions

View File

@@ -331,11 +331,9 @@ impl WindowManager {
SocketMessage::UnstackAll => self.unstack_all()?, SocketMessage::UnstackAll => self.unstack_all()?,
SocketMessage::CycleStack(direction) => { SocketMessage::CycleStack(direction) => {
self.cycle_container_window_in_direction(direction)?; self.cycle_container_window_in_direction(direction)?;
self.focused_window()?.focus(self.mouse_follows_focus)?;
} }
SocketMessage::CycleStackIndex(direction) => { SocketMessage::CycleStackIndex(direction) => {
self.cycle_container_window_index_in_direction(direction)?; self.cycle_container_window_index_in_direction(direction)?;
self.focused_window()?.focus(self.mouse_follows_focus)?;
} }
SocketMessage::FocusStackWindow(idx) => { SocketMessage::FocusStackWindow(idx) => {
// In case you are using this command on a bar on a monitor // In case you are using this command on a bar on a monitor
@@ -346,7 +344,6 @@ impl WindowManager {
self.focus_monitor(monitor_idx)?; self.focus_monitor(monitor_idx)?;
} }
self.focus_container_window(idx)?; self.focus_container_window(idx)?;
self.focused_window()?.focus(self.mouse_follows_focus)?;
} }
SocketMessage::ForceFocus => { SocketMessage::ForceFocus => {
let focused_window = self.focused_window()?; let focused_window = self.focused_window()?;

View File

@@ -2535,6 +2535,10 @@ impl WindowManager {
container.focus_window(next_idx); container.focus_window(next_idx);
container.load_focused_window(); container.load_focused_window();
if let Some(window) = container.focused_window() {
window.focus(self.mouse_follows_focus)?;
}
self.update_focused_workspace(self.mouse_follows_focus, true) self.update_focused_workspace(self.mouse_follows_focus, true)
} }
@@ -2568,6 +2572,10 @@ impl WindowManager {
container.focus_window(next_idx); container.focus_window(next_idx);
container.load_focused_window(); container.load_focused_window();
if let Some(window) = container.focused_window() {
window.focus(self.mouse_follows_focus)?;
}
self.update_focused_workspace(self.mouse_follows_focus, true) self.update_focused_workspace(self.mouse_follows_focus, true)
} }
@@ -2598,6 +2606,10 @@ impl WindowManager {
container.focus_window(idx); container.focus_window(idx);
container.load_focused_window(); container.load_focused_window();
if let Some(window) = container.focused_window() {
window.focus(self.mouse_follows_focus)?;
}
self.update_focused_workspace(self.mouse_follows_focus, true) self.update_focused_workspace(self.mouse_follows_focus, true)
} }