From 298fbafe00eb3e298fec30391d2d316cb120805c Mon Sep 17 00:00:00 2001 From: alex-ds13 <145657253+alex-ds13@users.noreply.github.com> Date: Wed, 16 Oct 2024 12:49:58 +0100 Subject: [PATCH] feat(wm): add floating app info to ruledebug This commit adds a `matches_floating_applications` to the `RuleDebug` which allows users to know if a window was matched as a floating window when using the debug part of the GUI. --- komorebi/src/window.rs | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/komorebi/src/window.rs b/komorebi/src/window.rs index 75f472af9..85aab22ca 100644 --- a/komorebi/src/window.rs +++ b/komorebi/src/window.rs @@ -41,6 +41,7 @@ use crate::styles::WindowStyle; use crate::transparency_manager; use crate::window_manager_event::WindowManagerEvent; use crate::windows_api::WindowsApi; +use crate::FLOATING_APPLICATIONS; use crate::HIDDEN_HWNDS; use crate::HIDING_BEHAVIOUR; use crate::IGNORE_IDENTIFIERS; @@ -565,6 +566,7 @@ pub struct RuleDebug { pub matches_ignore_identifier: Option, pub matches_managed_override: Option, pub matches_layered_whitelist: Option, + pub matches_floating_applications: Option, pub matches_wsl2_gui: Option, pub matches_no_titlebar: Option, } @@ -592,7 +594,7 @@ fn window_is_eligible( let regex_identifiers = REGEX_IDENTIFIERS.lock(); let ignore_identifiers = IGNORE_IDENTIFIERS.lock(); - let should_float = if let Some(rule) = should_act( + let should_ignore = if let Some(rule) = should_act( title, exe_name, class, @@ -621,7 +623,19 @@ fn window_is_eligible( false }; - if should_float && !managed_override { + let floating_identifiers = FLOATING_APPLICATIONS.lock(); + if let Some(rule) = should_act( + title, + exe_name, + class, + path, + &floating_identifiers, + ®ex_identifiers, + ) { + debug.matches_floating_applications = Some(rule); + } + + if should_ignore && !managed_override { return false; }