Skip to content

Commit

Permalink
fix(wm): add hack for new firefox windows
Browse files Browse the repository at this point in the history
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.

The idea to add a sleep instead of spamming the output with dbg! calls
comes from @Kornel@mastodon.social:

https://mastodon.social/@kornel/112125851048707993
  • Loading branch information
LGUG2Z committed Mar 20, 2024
1 parent dc38eae commit ca22cdb
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions komorebi/src/window.rs
Expand Up @@ -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;
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit ca22cdb

Please sign in to comment.