fix: linux, get_env, break loop (#12174)

Signed-off-by: fufesou <linlong1266@gmail.com>
This commit is contained in:
fufesou
2025-06-26 15:47:01 +08:00
committed by GitHub
parent bb6e080c1c
commit 58fd2d3ccd

View File

@@ -1047,7 +1047,7 @@ mod desktop {
fn get_display_xauth_xwayland(&mut self) {
let tray = format!("{} +--tray", crate::get_app_name().to_lowercase());
for _ in 0..5 {
for _ in 1..=10 {
let display_proc = vec![
XWAYLAND,
IBUS_DAEMON,
@@ -1060,7 +1060,7 @@ mod desktop {
self.xauth = get_env("XAUTHORITY", &self.uid, proc);
self.wl_display = get_env("WAYLAND_DISPLAY", &self.uid, proc);
if !self.display.is_empty() && !self.xauth.is_empty() {
break;
return;
}
}
sleep_millis(300);
@@ -1068,7 +1068,7 @@ mod desktop {
}
fn get_display_x11(&mut self) {
for _ in 0..10 {
for _ in 1..=10 {
let display_proc = vec![
XWAYLAND,
IBUS_DAEMON,
@@ -1083,6 +1083,9 @@ mod desktop {
break;
}
}
if !self.display.is_empty() {
break;
}
sleep_millis(300);
}
@@ -1152,7 +1155,7 @@ mod desktop {
fn get_xauth_x11(&mut self) {
// try by direct access to window manager process by name
let tray = format!("{} +--tray", crate::get_app_name().to_lowercase());
for _ in 0..10 {
for _ in 1..=10 {
let display_proc = vec![
XWAYLAND,
IBUS_DAEMON,
@@ -1168,6 +1171,9 @@ mod desktop {
break;
}
}
if !self.xauth.is_empty() {
break;
}
sleep_millis(300);
}