I set a menu during build as described in docs here
Then later in a command from front-end I set a a new menu but now the on_system_tray_event handler is no longer called.
I tried to replace the entire system tray but that causes the app to crash on right click. See stack trace.
I'm super new to Rust so this could very well all be incompetence. Grateful for any feedback / ideas. I've also opened a Stack Overflow issue to cover the incompetence situation
Reproduction
Updating the menu resulting in events no longer working
#[tauri::command]
fn set_system_tray_menu(app: AppHandle) {
let menu = SystemTrayMenu::new()
.add_item(CustomMenuItem::new("test".to_string(), "Test"));
match app.tray_handle().set_menu(menu) {
Ok(_) => {},
Err(error) => panic!("Problem setting system tray menu: {}", error),
};
}
Replacing the menu causing a crash
fn set_system_tray_menu(app: AppHandle) {
let menu = SystemTrayMenu::new()
.add_item(CustomMenuItem::new("test".to_string(), "Test"));
match SystemTray::new().with_menu(menu).build(&app) {
Ok(_) => {},
Err(error) => panic!("Problem setting system tray menu: {}", error),
};
}
Expected behavior
Either one of these:
The on_system_tray_event event handlers keep working
A way to assign new event handlers
Platform and versions
MacOS 12.6
Stack trace
2022-12-15 14:59:48.060 hotlist-tauri[49478:21361707] -[_WKInspectorConfiguration _setMenuOwner:]: unrecognized selector sent to instance 0x13e7ecdd0
thread 'main' panicked at 'Uncaught exception <NSException: 0x13e709a30>', /Users/rikschennink/.cargo/registry/src/github.com-1ecc6299db9ec823/cocoa-0.24.1/src/appkit.rs:3740:9
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Describe the bug
I set a menu during build as described in docs here
Then later in a command from front-end I set a a new menu but now the
on_system_tray_event
handler is no longer called.I tried to replace the entire system tray but that causes the app to crash on right click. See stack trace.
I'm super new to Rust so this could very well all be incompetence. Grateful for any feedback / ideas. I've also opened a Stack Overflow issue to cover the incompetence situation
Reproduction
Updating the menu resulting in events no longer working
Replacing the menu causing a crash
Expected behavior
Either one of these:
on_system_tray_event
event handlers keep workingPlatform and versions
MacOS 12.6
Stack trace
Additional context
No response