From a086d46a7576c0f4677f8b84c743599db99dfa22 Mon Sep 17 00:00:00 2001 From: LGUG2Z Date: Tue, 19 Mar 2024 20:02:55 -0700 Subject: [PATCH] fix(wm): add hack for new firefox windows This commit adds a 10 millisecond thread sleep specifically for Firefox as an interim solution for the race condition which results in new windows often not being tiled correctly until interacted with. --- komorebi/src/window.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/komorebi/src/window.rs b/komorebi/src/window.rs index 6f5506b6..09198485 100644 --- a/komorebi/src/window.rs +++ b/komorebi/src/window.rs @@ -4,6 +4,7 @@ use std::convert::TryFrom; use std::fmt::Display; use std::fmt::Formatter; use std::fmt::Write as _; +use std::time::Duration; use color_eyre::eyre; use color_eyre::eyre::anyhow; @@ -473,6 +474,10 @@ fn window_is_eligible( titlebars_removed.contains(exe_name) }; + if exe_name.contains("firefox") { + std::thread::sleep(Duration::from_millis(10)); + } + if (allow_wsl2_gui || allow_titlebar_removed || style.contains(WindowStyle::CAPTION) && ex_style.contains(ExtendedWindowStyle::WINDOWEDGE)) && !ex_style.contains(ExtendedWindowStyle::DLGMODALFRAME) // Get a lot of dupe events coming through that make the redrawing go crazy