feat(wm): selectively handle uncloak events

This commit adds selective handling for WindowManagerEvent::Uncloak
alongside Show and Manage, avoiding the workspace-switching logic that
is known to cause infinite workspace loops.
This commit is contained in:
LGUG2Z
2024-05-08 08:58:30 -07:00
parent 482a7b1d7f
commit 4802b55452
+6 -3
View File
@@ -284,7 +284,10 @@ impl WindowManager {
} }
} }
} }
WindowManagerEvent::Show(_, window) | WindowManagerEvent::Manage(window) => { WindowManagerEvent::Show(_, window)
| WindowManagerEvent::Manage(window)
| WindowManagerEvent::Uncloak(_, window) => {
if !matches!(event, WindowManagerEvent::Uncloak(_, _)) {
let mut switch_to = None; let mut switch_to = None;
for (i, monitors) in self.monitors().iter().enumerate() { for (i, monitors) in self.monitors().iter().enumerate() {
for (j, workspace) in monitors.workspaces().iter().enumerate() { for (j, workspace) in monitors.workspaces().iter().enumerate() {
@@ -307,6 +310,7 @@ impl WindowManager {
return Ok(()); return Ok(());
} }
} }
}
// There are some applications such as Firefox where, if they are focused when a // There are some applications such as Firefox where, if they are focused when a
// workspace switch takes place, it will fire an additional Show event, which will // workspace switch takes place, it will fire an additional Show event, which will
@@ -583,8 +587,7 @@ impl WindowManager {
} }
WindowManagerEvent::DisplayChange(..) WindowManagerEvent::DisplayChange(..)
| WindowManagerEvent::MouseCapture(..) | WindowManagerEvent::MouseCapture(..)
| WindowManagerEvent::Cloak(..) | WindowManagerEvent::Cloak(..) => {}
| WindowManagerEvent::Uncloak(..) => {}
}; };
if !self.focused_workspace()?.tile() { if !self.focused_workspace()?.tile() {