From b982021573e78969b2b6151124857a4fc0909c72 Mon Sep 17 00:00:00 2001 From: LGUG2Z Date: Tue, 28 Jun 2022 09:35:48 -0700 Subject: [PATCH] fix(wm): ensure manage > float rule priority This commit ensures that manage rules have priority over float rules. This is useful for applications such as Steam, where all windows including pop-ups have the same class name. The class name can be used with a float rule to ensure that all Steam pop-up windows are ignored, and then the title "Steam" can be used with a manage rule to ensure that the main Steam window does get managed. fix #163 --- komorebi/src/window.rs | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/komorebi/src/window.rs b/komorebi/src/window.rs index b3adfa37..509d200b 100644 --- a/komorebi/src/window.rs +++ b/komorebi/src/window.rs @@ -293,25 +293,35 @@ impl Window { // If not allowing cloaked windows, we need to ensure the window is not cloaked (false, false) => { if let (Ok(title), Ok(exe_name), Ok(class)) = (self.title(), self.exe(), self.class()) { + let mut should_float = false; + { let float_identifiers = FLOAT_IDENTIFIERS.lock(); for identifier in float_identifiers.iter() { if title.starts_with(identifier) || title.ends_with(identifier) || class.starts_with(identifier) || class.ends_with(identifier) || identifier == &exe_name { - return Ok(false); + should_float = true; } } } let managed_override = { let manage_identifiers = MANAGE_IDENTIFIERS.lock(); - manage_identifiers.contains(&exe_name) || manage_identifiers.contains(&class) + manage_identifiers.contains(&exe_name) + || manage_identifiers.contains(&class) + || manage_identifiers.contains(&title) }; + if should_float && !managed_override { + return Ok(false); + } + let allow_layered = { let layered_whitelist = LAYERED_WHITELIST.lock(); - layered_whitelist.contains(&exe_name) || layered_whitelist.contains(&class) + layered_whitelist.contains(&exe_name) + || layered_whitelist.contains(&class) + || layered_whitelist.contains(&title) }; let allow_wsl2_gui = {