tauri
tauri copied to clipboard
[feat] Easier updates for system tray menu
Describe the problem
I've gotten updates to work with the following approach, but they feel a bit inefficient
let tray = app.tray_by_id("main-tray").unwrap();
// Re-adding updated items to a new menu
let menu = MenuBuilder::new(app)
.items(... )
.build()
.unwrap();
// Replace the menu
tray.set_menu(Some(menu)).unwrap();
Describe the solution you'd like
It would probably be better to include the current menu as part of the tray so object so it can be modified.
let tray = app.tray_by_id("main-tray").unwrap();
let menu = tray.menu();
// We can then modify the menu
... menu.insert();
... menu.remove();
Alternatives considered
No response
Additional context
No response
+1