From 70be6f4ea4b9cc4d076fe4367a24a7053e850cbf Mon Sep 17 00:00:00 2001 From: LGUG2Z Date: Sun, 5 Jun 2022 15:18:11 -0700 Subject: [PATCH] feat(wm): start/end match on some float rules This commit tweaks how float rule matching for titles and classes works. Previously, they required an exact match to be triggered. This change allows starts_with and ends_with matches on classes and window titles to also trigger a float rule for applications that dynamically change their window titles or window classes. Exe matches are still required to be exact. --- komorebi/src/window.rs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/komorebi/src/window.rs b/komorebi/src/window.rs index b679cfde..e01af49d 100644 --- a/komorebi/src/window.rs +++ b/komorebi/src/window.rs @@ -283,10 +283,12 @@ impl Window { if let (Ok(title), Ok(exe_name), Ok(class)) = (self.title(), self.exe(), self.class()) { { let float_identifiers = FLOAT_IDENTIFIERS.lock(); - if float_identifiers.contains(&title) - || float_identifiers.contains(&exe_name) - || float_identifiers.contains(&class) { - return Ok(false); + 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); + } } }