checkbox and icon are both supported: https://docs.rs/tray-icon/latest/tray_icon/menu/index.html#structs if you compare MenuItem/MenuItemBuilder with IconMenuItem/IconBuilderItem you'll notice that the apis are almost the same, just with another argument to set the icon (same for CheckMenuItem), so you can hopefuly translate the existing repo examples easily.
and dynamic add sub menuitems.
If you mean updating the existing menu at runtime then i don't think that's possible but you can always set a new menu: https://docs.rs/tray-icon/latest/tray_icon/struct.TrayIcon.html#method.set_menu
use tray_icon::{Icon, menu::{Menu, MenuItem, CheckMenuItem, IconMenuItem, CheckMenuItemBuilder, IconMenuItemBuilder }};
fn test_menu_items() {
let item = MenuItem::new("menu1", true, None);
let item2 = MenuItem::with_id(123, "menu2", true, None);
let item3 = CheckMenuItem::with_id(124, "item3", true, true, None);
let menu4 = IconMenuItem::with_id(125, "item5", true, None, None);
//todo need a menu item with checkbox and icon at the same time
}
Originally posted by @FabianLars in #328
--- request ---
i have read the docs and src code
IconMenuItem
CheckMenuItem
i found there is no way to create a menuitem has both checkbox and icon