From a054de744a46ddb43554b97d28c71b206703c883 Mon Sep 17 00:00:00 2001 From: rustdesk Date: Fri, 23 Jan 2026 19:06:03 +0800 Subject: [PATCH] =?UTF-8?q?=20fix=20hide-tray=3DY=20causing=20The=20applic?= =?UTF-8?q?ation=20=E2=80=9CRustDesk.app=E2=80=9D=20is=20not=20open=20anym?= =?UTF-8?q?ore.=20=20https://github.com/rustdesk/rustdesk/discussions/1021?= =?UTF-8?q?0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/tray.rs | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/tray.rs b/src/tray.rs index f36da2cec..8ab4e3ecb 100644 --- a/src/tray.rs +++ b/src/tray.rs @@ -10,12 +10,6 @@ use std::time::Duration; pub fn start_tray() { if crate::ui_interface::get_builtin_option(hbb_common::config::keys::OPTION_HIDE_TRAY) == "Y" { - #[cfg(target_os = "macos")] - { - loop { - std::thread::sleep(std::time::Duration::from_secs(1)); - } - } #[cfg(not(target_os = "macos"))] { return; @@ -129,6 +123,11 @@ fn make_tray() -> hbb_common::ResultType<()> { ); if let tao::event::Event::NewEvents(tao::event::StartCause::Init) = event { + // for fixing https://github.com/rustdesk/rustdesk/discussions/10210#discussioncomment-14600745 + // so we start tray, but not to show it + if crate::ui_interface::get_builtin_option(hbb_common::config::keys::OPTION_HIDE_TRAY) == "Y" { + return; + } // We create the icon once the event loop is actually running // to prevent issues like https://github.com/tauri-apps/tray-icon/issues/90 let tray = TrayIconBuilder::new()