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()