Fix tray icon click (regression due to breaking change in tray-icon 0.17) (#15413)

This commit is contained in:
Daniel Marschall
2026-06-25 03:43:04 +02:00
committed by GitHub
parent b8117c5c34
commit 0cbdb6ffb3

View File

@@ -143,12 +143,21 @@ fn make_tray() -> hbb_common::ResultType<()> {
}
// 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()
let mut builder = TrayIconBuilder::new()
.with_menu(Box::new(tray_menu.clone()))
.with_tooltip(tooltip(0))
.with_icon(icon.clone())
.with_icon_as_template(true) // mac only
.build();
.with_icon(icon.clone());
#[cfg(target_os = "macos")]
{
builder = builder.with_icon_as_template(true);
}
#[cfg(target_os = "windows")]
{
// Required since tray-icon 0.17
// Fixes #15215, #15222, #15410
builder = builder.with_menu_on_left_click(false);
}
let tray = builder.build();
match tray {
Ok(tray) => _tray_icon = Arc::new(Mutex::new(Some(tray))),
Err(err) => {