mirror of
https://github.com/LGUG2Z/komorebi.git
synced 2026-03-28 12:11:59 +01:00
fix(wm): improve startup reliability
This commit wraps calls to the Windows API which may intermittently fail in backoff blocks, reducing the potential of early exits from errors returned by the Windows API before the tiling has even started. Hopefully this makes calls to 'komorebic start' more relible for use at login time.
This commit is contained in:
@@ -434,8 +434,41 @@ fn main() -> Result<()> {
|
||||
detect_deadlocks();
|
||||
|
||||
let process_id = WindowsApi::current_process_id();
|
||||
WindowsApi::allow_set_foreground_window(process_id)?;
|
||||
WindowsApi::set_process_dpi_awareness_context()?;
|
||||
|
||||
{
|
||||
let mut proceed = false;
|
||||
let backoff = Backoff::new();
|
||||
|
||||
while !proceed {
|
||||
if WindowsApi::allow_set_foreground_window(process_id).is_ok() {
|
||||
proceed = true;
|
||||
} else {
|
||||
tracing::warn!(
|
||||
"could not allow komorebi to set foreground windows, retrying..."
|
||||
);
|
||||
|
||||
backoff.snooze();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
let mut proceed = false;
|
||||
let backoff = Backoff::new();
|
||||
|
||||
while !proceed {
|
||||
if WindowsApi::set_process_dpi_awareness_context().is_ok() {
|
||||
proceed = true;
|
||||
} else {
|
||||
tracing::warn!(
|
||||
"could not allow komorebi to set itself as dpi-aware, retrying..."
|
||||
);
|
||||
|
||||
backoff.snooze();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Border::create("komorebi-border-window")?;
|
||||
|
||||
let (outgoing, incoming): (Sender<WindowManagerEvent>, Receiver<WindowManagerEvent>) =
|
||||
|
||||
Reference in New Issue
Block a user