mirror of
https://github.com/LGUG2Z/komorebi.git
synced 2026-03-18 23:44:00 +01:00
fix(wm): don't attach to the desktop window thread
Noticed in the logs when looking at issue #2 that an "Access is denied. (os error 5)" error was being reported when trying to attach to the thread of the special Desktop Window, which only happens when switching to a workspace which doesn't contain any windows. Calling WindowsApi::set_foreground_window on the HWND directly seems to be the better option here.
This commit is contained in:
@@ -89,7 +89,11 @@ impl WindowManager {
|
||||
hwnd: WindowsApi::desktop_window()?,
|
||||
};
|
||||
|
||||
desktop_window.focus()?;
|
||||
// Calling this directly instead of the window.focus() wrapper because trying to
|
||||
// attach to the thread of the desktop window always seems to result in "Access is
|
||||
// denied (os error 5)"
|
||||
WindowsApi::set_foreground_window(desktop_window.hwnd())
|
||||
.map_err(|error| eyre::anyhow!("{} {}:{}", error, file!(), line!()))?;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user