Skip to content

[Request] menuitem need support icon and checkbox at the same time #329

Description

@goldli

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

Originally posted by @FabianLars in #328

--- request ---

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
}

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions