fix hide-tray=Y causing The application “RustDesk.app” is not open anymore. https://github.com/rustdesk/rustdesk/discussions/10210

This commit is contained in:
rustdesk
2026-01-23 19:06:03 +08:00
parent e4b06dadf5
commit a054de744a

View File

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