mirror of
https://github.com/LGUG2Z/komorebi.git
synced 2026-03-29 05:31:55 +02:00
fix(wm): prevent dupes when enforcing ws rules
This commit ensures that we check if a window is already managed in any workspaces even after checking known_hwnds, because windows moved as part of the earlier ensure_workspace_rules call can slip through the cracks.
This commit is contained in:
@@ -431,6 +431,24 @@ impl WindowManager {
|
||||
proceed = false;
|
||||
}
|
||||
|
||||
// after enforce_workspace_rules() has run, check if window exists in ANY workspace
|
||||
// to prevent duplication when workspace rules move windows across workspaces
|
||||
if proceed {
|
||||
let window_already_managed = self
|
||||
.monitors()
|
||||
.iter()
|
||||
.flat_map(|m| m.workspaces())
|
||||
.any(|ws| ws.contains_window(window.hwnd));
|
||||
|
||||
if window_already_managed {
|
||||
tracing::debug!(
|
||||
"skipping window addition, already managed after workspace rule enforcement"
|
||||
);
|
||||
|
||||
proceed = false;
|
||||
}
|
||||
}
|
||||
|
||||
if proceed {
|
||||
let behaviour = self.window_management_behaviour(
|
||||
focused_monitor_idx,
|
||||
|
||||
Reference in New Issue
Block a user