Skip to content

Commit

Permalink
feat(wm): add floating app info to ruledebug
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
alex-ds13 authored and LGUG2Z committed Oct 16, 2024
1 parent e46a1a6 commit 298fbaf
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions komorebi/src/window.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -565,6 +566,7 @@ pub struct RuleDebug {
pub matches_ignore_identifier: Option<MatchingRule>,
pub matches_managed_override: Option<MatchingRule>,
pub matches_layered_whitelist: Option<MatchingRule>,
pub matches_floating_applications: Option<MatchingRule>,
pub matches_wsl2_gui: Option<String>,
pub matches_no_titlebar: Option<String>,
}
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
&regex_identifiers,
) {
debug.matches_floating_applications = Some(rule);
}

if should_ignore && !managed_override {
return false;
}

Expand Down

0 comments on commit 298fbaf

Please sign in to comment.