Tauri Core API - v2.6.0
    Preparing search index...

    Interface TrayIconOptions

    TrayIcon creation options

    interface TrayIconOptions {
        id?: string;
        menu?: Submenu | Menu;
        icon?:
            | string
            | number[]
            | ArrayBuffer
            | Uint8Array<ArrayBufferLike>
            | Image;
        tooltip?: string;
        title?: string;
        tempDirPath?: string;
        iconAsTemplate?: boolean;
        menuOnLeftClick?: boolean;
        showMenuOnLeftClick?: boolean;
        action?: (event: TrayIconEvent) => void;
    }
    Index

    Properties

    id?: string

    The tray icon id. If undefined, a random one will be assigned

    menu?: Submenu | Menu

    The tray icon menu

    icon?: string | number[] | ArrayBuffer | Uint8Array<ArrayBufferLike> | Image

    The tray icon which could be icon bytes or path to the icon file.

    Note that you may need the image-ico or image-png Cargo features to use this API. To enable it, change your Cargo.toml file:

    [dependencies]
    tauri = { version = "...", features = ["...", "image-png"] }
    tooltip?: string

    The tray icon tooltip

    title?: string

    The tray title

    • Linux: The title will not be shown unless there is an icon as well. The title is useful for numerical and other frequently updated information. In general, it shouldn't be shown unless a user requests it as it can take up a significant amount of space on the user's panel. This may not be shown in all visualizations.
    • Windows: Unsupported.
    tempDirPath?: string

    The tray icon temp dir path. Linux only.

    On Linux, we need to write the icon to the disk and usually it will be $XDG_RUNTIME_DIR/tray-icon or $TEMP/tray-icon.

    iconAsTemplate?: boolean

    Use the icon as a template. macOS only.

    menuOnLeftClick?: boolean

    Whether to show the tray menu on left click or not, default is true.

    • Linux: Unsupported.

    use TrayIconOptions.showMenuOnLeftClick instead.

    showMenuOnLeftClick?: boolean

    Whether to show the tray menu on left click or not, default is true.

    • Linux: Unsupported.

    2.2.0

    action?: (event: TrayIconEvent) => void

    A handler for an event on the tray icon.