mirror of
https://github.com/LGUG2Z/komorebi.git
synced 2026-05-17 09:17:02 +02:00
feat(wm): add max number of attempts to set foreground
this commits adds a max number of attempts (5) to the call of set_foreground_window inside Window:Focus
This commit is contained in:
@@ -258,12 +258,14 @@ impl Window {
|
|||||||
|
|
||||||
// Raise Window to foreground
|
// Raise Window to foreground
|
||||||
let mut foregrounded = false;
|
let mut foregrounded = false;
|
||||||
while !foregrounded {
|
let mut max_attempts = 5;
|
||||||
|
while !foregrounded && max_attempts > 0 {
|
||||||
match WindowsApi::set_foreground_window(self.hwnd()) {
|
match WindowsApi::set_foreground_window(self.hwnd()) {
|
||||||
Ok(_) => {
|
Ok(_) => {
|
||||||
foregrounded = true;
|
foregrounded = true;
|
||||||
}
|
}
|
||||||
Err(error) => {
|
Err(error) => {
|
||||||
|
max_attempts -= 1;
|
||||||
tracing::error!(
|
tracing::error!(
|
||||||
"could not set as foreground window, but continuing execution of focus(): {}",
|
"could not set as foreground window, but continuing execution of focus(): {}",
|
||||||
error
|
error
|
||||||
|
|||||||
Reference in New Issue
Block a user