Skip to content

Commit

Permalink
feat(wm): start/end match on some float rules
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
LGUG2Z committed Jun 5, 2022
1 parent e09d55e commit 70be6f4
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions komorebi/src/window.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
}

Expand Down

0 comments on commit 70be6f4

Please sign in to comment.