Skip to content

Commit

Permalink
fix(wm): ensure manage > float rule priority
Browse files Browse the repository at this point in the history
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
  • Loading branch information
LGUG2Z committed Jun 29, 2022
1 parent 3c84bfd commit b982021
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions komorebi/src/window.rs
Expand Up @@ -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 = {
Expand Down

0 comments on commit b982021

Please sign in to comment.