foo-webview-sdk
    Preparing search index...

    Variable trayConst

    tray: {
        appendMenuItems: (
            items: TrayMenuItem[],
            position?: TrayMenuPosition,
        ) => Promise<TrayAppendMenuItemsResponse>;
        clearMenuItems: (
            position?: TrayMenuPosition,
        ) => Promise<TrayClearMenuItemsResponse>;
        create: (
            opts?: { icon?: string | null; tooltip?: string },
        ) => Promise<TrayCreateResponse>;
        destroy: () => Promise<TrayDestroyResponse>;
        getMenuItems: () => Promise<TrayGetMenuItemsResponse>;
        isVisible: () => Promise<TrayIsVisibleResponse>;
        removeMenuItems: (ids: string[]) => Promise<TrayRemoveMenuItemsResponse>;
        setClickAction: (
            action: "event" | "toggleMainWindow",
        ) => Promise<TraySetClickActionResponse>;
        setCloseToTray: (enabled: boolean) => Promise<TraySetCloseToTrayResponse>;
        setContextMenu: (
            items: TrayMenuItem[],
            config?: TrayMenuConfig,
        ) => Promise<TraySetContextMenuResponse>;
        setIcon: (icon?: string | null) => Promise<TraySetIconResponse>;
        setMenuItemState: (
            id: string,
            state: { checked?: boolean; enabled?: boolean },
        ) => Promise<TraySetMenuItemStateResponse>;
        setMenuZones: (
            zones: Omit<TraySetMenuZonesParams, "config">,
            config?: TrayMenuConfig,
        ) => Promise<TraySetMenuZonesResponse>;
        setMinimizeToTray: (
            enabled: boolean,
        ) => Promise<TraySetMinimizeToTrayResponse>;
        setTooltip: (tooltip: string) => Promise<TraySetTooltipResponse>;
        showBalloon: (
            opts: {
                icon?: "error" | "info" | "warning";
                message: string;
                title: string;
            },
        ) => Promise<TrayShowBalloonResponse>;
    } = ...

    tray namespace - system tray icon bindings.

    See the taskbar-tray page of the API reference for the full contract.

    Type Declaration

    • appendMenuItems: (
          items: TrayMenuItem[],
          position?: TrayMenuPosition,
      ) => Promise<TrayAppendMenuItemsResponse>

      Append items to the given zone (default 'top').

    • clearMenuItems: (position?: TrayMenuPosition) => Promise<TrayClearMenuItemsResponse>

      Clear the given zone, or all zones if position is omitted.

    • create: (
          opts?: { icon?: string | null; tooltip?: string },
      ) => Promise<TrayCreateResponse>

      Create the tray icon, preserving any previously configured click action.

    • destroy: () => Promise<TrayDestroyResponse>

      Remove the icon, cancel pending clicks and reset the click action to event.

    • getMenuItems: () => Promise<TrayGetMenuItemsResponse>

      Get all user-defined menu items, flattened in zone order (top -> playback -> bottom). Built-in items injected by showPlaybackControls / showSystemItems are not included.

    • isVisible: () => Promise<TrayIsVisibleResponse>

      Resolve whether the tray icon currently exists.

    • removeMenuItems: (ids: string[]) => Promise<TrayRemoveMenuItemsResponse>

      Remove items with the given ids from all zones, submenus included. Resolves with the number removed.

    • setClickAction: (action: "event" | "toggleMainWindow") => Promise<TraySetClickActionResponse>

      Select the process-wide left-click action, even before creating the icon. event preserves existing click notifications. toggleMainWindow handles each gesture natively, including while the page is suspended, and emits neither click nor double-click events. It preserves window placement and tray settings. Every call cancels pending clicks; the latest successful caller wins. Remove click handlers that issue window commands before enabling native mode; events already queued in a page cannot be recalled. Panel mode is unsupported.

    • setCloseToTray: (enabled: boolean) => Promise<TraySetCloseToTrayResponse>

      Hide to the tray instead of quitting when the window is closed.

    • setContextMenu: (
          items: TrayMenuItem[],
          config?: TrayMenuConfig,
      ) => Promise<TraySetContextMenuResponse>

      Replace the items of the zone determined by config.customPosition (default 'top'). The other two zones are left intact. Use setMenuZones to replace every zone at once, and the incremental helpers below for partial updates.

    • setIcon: (icon?: string | null) => Promise<TraySetIconResponse>

      Replace the tray icon image; omit or pass null to fall back to the main icon.

    • setMenuItemState: (
          id: string,
          state: { checked?: boolean; enabled?: boolean },
      ) => Promise<TraySetMenuItemStateResponse>

      Update a single menu item's checked / enabled state in place. The id is searched across all zones and recursively into submenus. At least one of checked / enabled must be supplied. This is a granular alternative to setContextMenu, which performs a full-zone replace.

      Providing checked (true or false) marks the item checkable so subsequent getMenuItems() and the WebView overlay keep checkbox semantics even when the value is false.

      The native tray menu is rebuilt from stored data each time it is opened, so the new state takes effect on the next open rather than mutating a menu that is already showing. An id no row has fails with NOT_FOUND.

    • setMenuZones: (
          zones: Omit<TraySetMenuZonesParams, "config">,
          config?: TrayMenuConfig,
      ) => Promise<TraySetMenuZonesResponse>

      Replace the items of all three zones in one call; a zone left out is cleared. The built-in items of showPlaybackControls and showSystemItems are not stored in the zones and stay. When an item is rejected or the resource limits are exceeded, nothing is stored, config included.

      Prefer this to clearMenuItems followed by appendMenuItems when the whole menu changes: a menu opened between those calls shows part of the update, and two such updates that interleave add their items twice. Of two calls sent back to back, the later one is what remains.

    • setMinimizeToTray: (enabled: boolean) => Promise<TraySetMinimizeToTrayResponse>

      Hide to the tray instead of the taskbar when the window is minimized.

    • setTooltip: (tooltip: string) => Promise<TraySetTooltipResponse>

      Update the hover tooltip (max 128 characters).

    • showBalloon: (
          opts: {
              icon?: "error" | "info" | "warning";
              message: string;
              title: string;
          },
      ) => Promise<TrayShowBalloonResponse>

      Show a balloon notification. icon is 'info' (default) / 'warning' / 'error'.