tauri icon indicating copy to clipboard operation
tauri copied to clipboard

[feat] Easier updates for system tray menu

Open jorge-menjivar opened this issue 3 months ago • 1 comments

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

jorge-menjivar avatar Mar 26 '24 16:03 jorge-menjivar

+1

kitty-eu-org avatar Apr 19 '24 15:04 kitty-eu-org