From 2050d9a3fa7b776c1a9642ef71ae891c3f4d98d1 Mon Sep 17 00:00:00 2001 From: LGUG2Z Date: Mon, 5 Jun 2023 09:58:37 -0700 Subject: [PATCH] fix(wm): add permaignore_classes for electron jank --- komorebi/src/main.rs | 3 +++ komorebi/src/window.rs | 13 ++++++++----- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/komorebi/src/main.rs b/komorebi/src/main.rs index d90f948c..bd060292 100644 --- a/komorebi/src/main.rs +++ b/komorebi/src/main.rs @@ -103,6 +103,9 @@ lazy_static! { "OPContainerClass".to_string(), "IHWindowClass".to_string() ])); + static ref PERMAIGNORE_CLASSES: Arc>> = Arc::new(Mutex::new(vec![ + "Chrome_RenderWidgetHostHWND".to_string(), + ])); static ref BORDER_OVERFLOW_IDENTIFIERS: Arc>> = Arc::new(Mutex::new(vec![])); static ref WSL2_UI_PROCESSES: Arc>> = Arc::new(Mutex::new(vec![ "X410.exe".to_string(), diff --git a/komorebi/src/window.rs b/komorebi/src/window.rs index b383e148..03583d6e 100644 --- a/komorebi/src/window.rs +++ b/komorebi/src/window.rs @@ -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; @@ -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)] @@ -460,25 +460,28 @@ fn window_is_eligible( ex_style: &ExtendedWindowStyle, event: Option, ) -> 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); } } };