Skip to content

Commit

Permalink
fix(wm): add permaignore_classes for electron jank
Browse files Browse the repository at this point in the history
  • Loading branch information
LGUG2Z committed Jun 5, 2023
1 parent 8e47bfd commit 2050d9a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
3 changes: 3 additions & 0 deletions komorebi/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,9 @@ lazy_static! {
"OPContainerClass".to_string(),
"IHWindowClass".to_string()
]));
static ref PERMAIGNORE_CLASSES: Arc<Mutex<Vec<String>>> = Arc::new(Mutex::new(vec![
"Chrome_RenderWidgetHostHWND".to_string(),
]));
static ref BORDER_OVERFLOW_IDENTIFIERS: Arc<Mutex<Vec<String>>> = Arc::new(Mutex::new(vec![]));
static ref WSL2_UI_PROCESSES: Arc<Mutex<Vec<String>>> = Arc::new(Mutex::new(vec![
"X410.exe".to_string(),
Expand Down
13 changes: 8 additions & 5 deletions komorebi/src/window.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ use winput::press;
use winput::release;
use winput::Vk;

use komorebi_core::ApplicationIdentifier;
use komorebi_core::HidingBehaviour;
use komorebi_core::Rect;

Expand All @@ -33,6 +32,7 @@ use crate::HIDING_BEHAVIOUR;
use crate::LAYERED_WHITELIST;
use crate::MANAGE_IDENTIFIERS;
use crate::NO_TITLEBAR;
use crate::PERMAIGNORE_CLASSES;
use crate::WSL2_UI_PROCESSES;

#[derive(Debug, Clone, Copy, JsonSchema)]
Expand Down Expand Up @@ -460,25 +460,28 @@ fn window_is_eligible(
ex_style: &ExtendedWindowStyle,
event: Option<WindowManagerEvent>,
) -> bool {
{
let permaignore_classes = PERMAIGNORE_CLASSES.lock();
if permaignore_classes.contains(class) {
return false;
}
}

let mut should_float = false;
let mut matched_identifier = None;

{
let float_identifiers = FLOAT_IDENTIFIERS.lock();
for identifier in float_identifiers.iter() {
if title.starts_with(identifier) || title.ends_with(identifier) {
should_float = true;
matched_identifier = Option::from(ApplicationIdentifier::Title);
}

if class.starts_with(identifier) || class.ends_with(identifier) {
should_float = true;
matched_identifier = Option::from(ApplicationIdentifier::Class);
}

if identifier == exe_name {
should_float = true;
matched_identifier = Option::from(ApplicationIdentifier::Exe);
}
}
};
Expand Down

0 comments on commit 2050d9a

Please sign in to comment.