Header menu logo fable-electron-docs-api

Tray Type

⚠ Process Availability: Main ✔ | Renderer ❌ | Utility ❌ | Exported ✔### Class: Tray> Add icons and context menus to the system's notification area.Process: MainTray is an EventEmitter.const { app, Menu, Tray } = require('electron')let tray = nullapp.whenReady().then(() => { tray = new Tray('/path/to/my/icon') const contextMenu = Menu.buildFromTemplate([ { label: 'Item1', type: 'radio' }, { label: 'Item2', type: 'radio' }, { label: 'Item3', type: 'radio', checked: true }, { label: 'Item4', type: 'radio' } ]) tray.setToolTip('This is my application.') tray.setContextMenu(contextMenu)})> [!TIP] See also: A detailed guide about how to implement Tray menus.> [!WARNING] Electron's built-in classes cannot be subclassed in user code. For more information, see the FAQ.Platform Considerations*Linux Tray icon uses StatusNotifierItem by default, when it is not available in user's desktop environment the GtkStatusIcon will be used instead. The click event is emitted when the tray icon receives activation from user, however the StatusNotifierItem spec does not specify which action would cause an activation, for some environments it is left mouse click, but for some it might be double left mouse click. In order for changes made to individual MenuItems to take effect, you have to call setContextMenu again. For example:const { app, Menu, Tray } = require('electron')let appIcon = nullapp.whenReady().then(() => { appIcon = new Tray('/path/to/my/icon') const contextMenu = Menu.buildFromTemplate([ { label: 'Item1', type: 'radio' }, { label: 'Item2', type: 'radio' } ]) // Make a change to the context menu contextMenu.items[1].checked = false // Call this again for Linux because we modified the context menu appIcon.setContextMenu(contextMenu)})MacOS* Icons passed to the Tray constructor should be Template Images.* To make sure your icon isn't grainy on retina monitors, be sure your @2x image is 144dpi.* If you are bundling your application (e.g., with webpack for development), be sure that the file names are not being mangled or hashed. The filename needs to end in Template, and the @2x image needs to have the same filename as the standard image, or MacOS will not magically invert your image's colors or use the high density image.* 16x16 (72dpi) and 32x32@2x (144dpi) work well for most icons.Windows* It is recommended to use ICO icons to get best visual effects.

Constructors

Constructor Description

Tray(image, ?guid)

Full Usage: Tray(image, ?guid)

Parameters:
    image : U2<NativeImage, string> -
    ?guid : string - A unique string used to identify the tray icon. Must adhere to UUID format.

Returns: Tray
image : U2<NativeImage, string>

?guid : string

A unique string used to identify the tray icon. Must adhere to UUID format.

Returns: Tray

Instance members

Instance member Description

this.closeContextMenu ()

Full Usage: this.closeContextMenu ()

Modifiers: inline

⚠ OS Compatibility: WIN ✔ | MAC ✔ | LIN ❌ | MAS ❌

Closes an open context menu, as set by tray.setContextMenu().

this.destroy ()

Full Usage: this.destroy ()

Modifiers: inline

Destroys the tray icon immediately.

this.displayBalloon (?icon, ?iconType, ?title, ?content, ?largeIcon, ?noSound, ?respectQuietTime)

Full Usage: this.displayBalloon (?icon, ?iconType, ?title, ?content, ?largeIcon, ?noSound, ?respectQuietTime)

Parameters:
    ?icon : U2<NativeImage, string>
    ?iconType : IconType
    ?title : string
    ?content : string
    ?largeIcon : bool
    ?noSound : bool
    ?respectQuietTime : bool

Modifiers: inline

⚠ OS Compatibility: WIN ✔ | MAC ❌ | LIN ❌ | MAS ❌

Displays a tray balloon.

?icon : U2<NativeImage, string>
?iconType : IconType
?title : string
?content : string
?largeIcon : bool
?noSound : bool
?respectQuietTime : bool

this.focus ()

Full Usage: this.focus ()

Modifiers: inline

⚠ OS Compatibility: WIN ✔ | MAC ❌ | LIN ❌ | MAS ❌

Returns focus to the taskbar notification area. Notification area icons should use this message when they have completed their UI operation. For example, if the icon displays a shortcut menu, but the user presses ESC to cancel it, use tray.focus() to return focus to the notification area.

this.getBounds ()

Full Usage: this.getBounds ()

Returns: Rectangle
Modifiers: inline

⚠ OS Compatibility: WIN ✔ | MAC ✔ | LIN ❌ | MAS ❌

The bounds of this tray icon as Object.

Returns: Rectangle

this.getGUID ()

Full Usage: this.getGUID ()

Returns: Option<string>
Modifiers: inline

⚠ OS Compatibility: WIN ✔ | MAC ✔ | LIN ❌ | MAS ❌

The GUID used to uniquely identify the tray icon and allow it to retain its position between relaunches, or null if none is set.

Returns: Option<string>

this.getIgnoreDoubleClickEvents ()

Full Usage: this.getIgnoreDoubleClickEvents ()

Returns: bool
Modifiers: inline

⚠ OS Compatibility: WIN ❌ | MAC ✔ | LIN ❌ | MAS ❌

Whether double click events will be ignored.

Returns: bool

this.getTitle ()

Full Usage: this.getTitle ()

Returns: string
Modifiers: inline

⚠ OS Compatibility: WIN ❌ | MAC ✔ | LIN ❌ | MAS ❌

the title displayed next to the tray icon in the status bar

Returns: string

this.isDestroyed ()

Full Usage: this.isDestroyed ()

Returns: bool
Modifiers: inline

Whether the tray icon is destroyed.

Returns: bool

this.offBalloonClick handler

Full Usage: this.offBalloonClick handler

Parameters:
    handler : unit -> unit

Modifiers: inline

⚠ OS Compatibility: WIN ✔ | MAC ❌ | LIN ❌ | MAS ❌

Emitted when the tray balloon is clicked.

handler : unit -> unit

this.offBalloonClosed handler

Full Usage: this.offBalloonClosed handler

Parameters:
    handler : unit -> unit

Modifiers: inline

⚠ OS Compatibility: WIN ✔ | MAC ❌ | LIN ❌ | MAS ❌

Emitted when the tray balloon is closed because of timeout or user manually closes it.

handler : unit -> unit

this.offBalloonShow handler

Full Usage: this.offBalloonShow handler

Parameters:
    handler : unit -> unit

Modifiers: inline

⚠ OS Compatibility: WIN ✔ | MAC ❌ | LIN ❌ | MAS ❌

Emitted when the tray balloon shows.

handler : unit -> unit

this.offClick handler

Full Usage: this.offClick handler

Parameters:
Modifiers: inline

Emitted when the tray icon is clicked.Note that on Linux this event is emitted when the tray icon receives an activation, which might not necessarily be left mouse click.

handler : IOnClick -> unit

this.offClick handler

Full Usage: this.offClick handler

Parameters:
Modifiers: inline

Emitted when the tray icon is clicked.Note that on Linux this event is emitted when the tray icon receives an activation, which might not necessarily be left mouse click.

handler : KeyboardEvent -> Rectangle -> Point -> unit

this.offDoubleClick handler

Full Usage: this.offDoubleClick handler

Parameters:
Modifiers: inline

⚠ OS Compatibility: WIN ✔ | MAC ✔ | LIN ❌ | MAS ❌

Emitted when the tray icon is double clicked.

handler : IOnDoubleClick -> unit

this.offDoubleClick handler

Full Usage: this.offDoubleClick handler

Parameters:
Modifiers: inline

⚠ OS Compatibility: WIN ✔ | MAC ✔ | LIN ❌ | MAS ❌

Emitted when the tray icon is double clicked.

handler : KeyboardEvent -> Rectangle -> unit

this.offDragEnd handler

Full Usage: this.offDragEnd handler

Parameters:
    handler : unit -> unit

Modifiers: inline

⚠ OS Compatibility: WIN ❌ | MAC ✔ | LIN ❌ | MAS ❌

Emitted when a drag operation ends on the tray or ends at another location.

handler : unit -> unit

this.offDragEnter handler

Full Usage: this.offDragEnter handler

Parameters:
    handler : unit -> unit

Modifiers: inline

⚠ OS Compatibility: WIN ❌ | MAC ✔ | LIN ❌ | MAS ❌

Emitted when a drag operation enters the tray icon.

handler : unit -> unit

this.offDragLeave handler

Full Usage: this.offDragLeave handler

Parameters:
    handler : unit -> unit

Modifiers: inline

⚠ OS Compatibility: WIN ❌ | MAC ✔ | LIN ❌ | MAS ❌

Emitted when a drag operation exits the tray icon.

handler : unit -> unit

this.offDrop handler

Full Usage: this.offDrop handler

Parameters:
    handler : unit -> unit

Modifiers: inline

⚠ OS Compatibility: WIN ❌ | MAC ✔ | LIN ❌ | MAS ❌

Emitted when any dragged items are dropped on the tray icon.

handler : unit -> unit

this.offDropFiles handler

Full Usage: this.offDropFiles handler

Parameters:
Modifiers: inline

⚠ OS Compatibility: WIN ❌ | MAC ✔ | LIN ❌ | MAS ❌

Emitted when dragged files are dropped in the tray icon.

handler : IOnDropFiles -> unit

this.offDropFiles handler

Full Usage: this.offDropFiles handler

Parameters:
    handler : Event -> string[] -> unit

Modifiers: inline

⚠ OS Compatibility: WIN ❌ | MAC ✔ | LIN ❌ | MAS ❌

Emitted when dragged files are dropped in the tray icon.

handler : Event -> string[] -> unit

this.offDropText handler

Full Usage: this.offDropText handler

Parameters:
Modifiers: inline

⚠ OS Compatibility: WIN ❌ | MAC ✔ | LIN ❌ | MAS ❌

Emitted when dragged text is dropped in the tray icon.

handler : IOnDropText -> unit

this.offDropText handler

Full Usage: this.offDropText handler

Parameters:
    handler : Event -> string -> unit

Modifiers: inline

⚠ OS Compatibility: WIN ❌ | MAC ✔ | LIN ❌ | MAS ❌

Emitted when dragged text is dropped in the tray icon.

handler : Event -> string -> unit

this.offMiddleClick handler

Full Usage: this.offMiddleClick handler

Parameters:
Modifiers: inline

⚠ OS Compatibility: WIN ✔ | MAC ❌ | LIN ❌ | MAS ❌

Emitted when the tray icon is middle clicked.

handler : IOnMiddleClick -> unit

this.offMiddleClick handler

Full Usage: this.offMiddleClick handler

Parameters:
Modifiers: inline

⚠ OS Compatibility: WIN ✔ | MAC ❌ | LIN ❌ | MAS ❌

Emitted when the tray icon is middle clicked.

handler : KeyboardEvent -> Rectangle -> unit

this.offMouseDown handler

Full Usage: this.offMouseDown handler

Parameters:
Modifiers: inline

⚠ OS Compatibility: WIN ❌ | MAC ✔ | LIN ❌ | MAS ❌

Emitted when the mouse clicks the tray icon.

handler : IOnMouseDown -> unit

this.offMouseDown handler

Full Usage: this.offMouseDown handler

Parameters:
Modifiers: inline

⚠ OS Compatibility: WIN ❌ | MAC ✔ | LIN ❌ | MAS ❌

Emitted when the mouse clicks the tray icon.

handler : KeyboardEvent -> Point -> unit

this.offMouseEnter handler

Full Usage: this.offMouseEnter handler

Parameters:
Modifiers: inline

⚠ OS Compatibility: WIN ✔ | MAC ✔ | LIN ❌ | MAS ❌

Emitted when the mouse enters the tray icon.

handler : IOnMouseEnter -> unit

this.offMouseEnter handler

Full Usage: this.offMouseEnter handler

Parameters:
Modifiers: inline

⚠ OS Compatibility: WIN ✔ | MAC ✔ | LIN ❌ | MAS ❌

Emitted when the mouse enters the tray icon.

handler : KeyboardEvent -> Point -> unit

this.offMouseLeave handler

Full Usage: this.offMouseLeave handler

Parameters:
Modifiers: inline

⚠ OS Compatibility: WIN ✔ | MAC ✔ | LIN ❌ | MAS ❌

Emitted when the mouse exits the tray icon.

handler : IOnMouseLeave -> unit

this.offMouseLeave handler

Full Usage: this.offMouseLeave handler

Parameters:
Modifiers: inline

⚠ OS Compatibility: WIN ✔ | MAC ✔ | LIN ❌ | MAS ❌

Emitted when the mouse exits the tray icon.

handler : KeyboardEvent -> Point -> unit

this.offMouseMove handler

Full Usage: this.offMouseMove handler

Parameters:
Modifiers: inline

⚠ OS Compatibility: WIN ✔ | MAC ✔ | LIN ❌ | MAS ❌

Emitted when the mouse moves in the tray icon.

handler : IOnMouseMove -> unit

this.offMouseMove handler

Full Usage: this.offMouseMove handler

Parameters:
Modifiers: inline

⚠ OS Compatibility: WIN ✔ | MAC ✔ | LIN ❌ | MAS ❌

Emitted when the mouse moves in the tray icon.

handler : KeyboardEvent -> Point -> unit

this.offMouseUp handler

Full Usage: this.offMouseUp handler

Parameters:
Modifiers: inline

⚠ OS Compatibility: WIN ❌ | MAC ✔ | LIN ❌ | MAS ❌

Emitted when the mouse is released from clicking the tray icon.> [!NOTE] This will not be emitted if you have set a context menu for your Tray using tray.setContextMenu, as a result of macOS-level constraints.

handler : IOnMouseUp -> unit

this.offMouseUp handler

Full Usage: this.offMouseUp handler

Parameters:
Modifiers: inline

⚠ OS Compatibility: WIN ❌ | MAC ✔ | LIN ❌ | MAS ❌

Emitted when the mouse is released from clicking the tray icon.> [!NOTE] This will not be emitted if you have set a context menu for your Tray using tray.setContextMenu, as a result of macOS-level constraints.

handler : KeyboardEvent -> Point -> unit

this.offRightClick handler

Full Usage: this.offRightClick handler

Parameters:
Modifiers: inline

⚠ OS Compatibility: WIN ✔ | MAC ✔ | LIN ❌ | MAS ❌

Emitted when the tray icon is right clicked.

handler : IOnRightClick -> unit

this.offRightClick handler

Full Usage: this.offRightClick handler

Parameters:
Modifiers: inline

⚠ OS Compatibility: WIN ✔ | MAC ✔ | LIN ❌ | MAS ❌

Emitted when the tray icon is right clicked.

handler : KeyboardEvent -> Rectangle -> unit

this.onBalloonClick handler

Full Usage: this.onBalloonClick handler

Parameters:
    handler : unit -> unit

Modifiers: inline

⚠ OS Compatibility: WIN ✔ | MAC ❌ | LIN ❌ | MAS ❌

Emitted when the tray balloon is clicked.

handler : unit -> unit

this.onBalloonClosed handler

Full Usage: this.onBalloonClosed handler

Parameters:
    handler : unit -> unit

Modifiers: inline

⚠ OS Compatibility: WIN ✔ | MAC ❌ | LIN ❌ | MAS ❌

Emitted when the tray balloon is closed because of timeout or user manually closes it.

handler : unit -> unit

this.onBalloonShow handler

Full Usage: this.onBalloonShow handler

Parameters:
    handler : unit -> unit

Modifiers: inline

⚠ OS Compatibility: WIN ✔ | MAC ❌ | LIN ❌ | MAS ❌

Emitted when the tray balloon shows.

handler : unit -> unit

this.onClick handler

Full Usage: this.onClick handler

Parameters:
Modifiers: inline

Emitted when the tray icon is clicked.Note that on Linux this event is emitted when the tray icon receives an activation, which might not necessarily be left mouse click.

handler : IOnClick -> unit

this.onClick handler

Full Usage: this.onClick handler

Parameters:
Modifiers: inline

Emitted when the tray icon is clicked.Note that on Linux this event is emitted when the tray icon receives an activation, which might not necessarily be left mouse click.

handler : KeyboardEvent -> Rectangle -> Point -> unit

this.onDoubleClick handler

Full Usage: this.onDoubleClick handler

Parameters:
Modifiers: inline

⚠ OS Compatibility: WIN ✔ | MAC ✔ | LIN ❌ | MAS ❌

Emitted when the tray icon is double clicked.

handler : IOnDoubleClick -> unit

this.onDoubleClick handler

Full Usage: this.onDoubleClick handler

Parameters:
Modifiers: inline

⚠ OS Compatibility: WIN ✔ | MAC ✔ | LIN ❌ | MAS ❌

Emitted when the tray icon is double clicked.

handler : KeyboardEvent -> Rectangle -> unit

this.onDragEnd handler

Full Usage: this.onDragEnd handler

Parameters:
    handler : unit -> unit

Modifiers: inline

⚠ OS Compatibility: WIN ❌ | MAC ✔ | LIN ❌ | MAS ❌

Emitted when a drag operation ends on the tray or ends at another location.

handler : unit -> unit

this.onDragEnter handler

Full Usage: this.onDragEnter handler

Parameters:
    handler : unit -> unit

Modifiers: inline

⚠ OS Compatibility: WIN ❌ | MAC ✔ | LIN ❌ | MAS ❌

Emitted when a drag operation enters the tray icon.

handler : unit -> unit

this.onDragLeave handler

Full Usage: this.onDragLeave handler

Parameters:
    handler : unit -> unit

Modifiers: inline

⚠ OS Compatibility: WIN ❌ | MAC ✔ | LIN ❌ | MAS ❌

Emitted when a drag operation exits the tray icon.

handler : unit -> unit

this.onDrop handler

Full Usage: this.onDrop handler

Parameters:
    handler : unit -> unit

Modifiers: inline

⚠ OS Compatibility: WIN ❌ | MAC ✔ | LIN ❌ | MAS ❌

Emitted when any dragged items are dropped on the tray icon.

handler : unit -> unit

this.onDropFiles handler

Full Usage: this.onDropFiles handler

Parameters:
Modifiers: inline

⚠ OS Compatibility: WIN ❌ | MAC ✔ | LIN ❌ | MAS ❌

Emitted when dragged files are dropped in the tray icon.

handler : IOnDropFiles -> unit

this.onDropFiles handler

Full Usage: this.onDropFiles handler

Parameters:
    handler : Event -> string[] -> unit

Modifiers: inline

⚠ OS Compatibility: WIN ❌ | MAC ✔ | LIN ❌ | MAS ❌

Emitted when dragged files are dropped in the tray icon.

handler : Event -> string[] -> unit

this.onDropText handler

Full Usage: this.onDropText handler

Parameters:
Modifiers: inline

⚠ OS Compatibility: WIN ❌ | MAC ✔ | LIN ❌ | MAS ❌

Emitted when dragged text is dropped in the tray icon.

handler : IOnDropText -> unit

this.onDropText handler

Full Usage: this.onDropText handler

Parameters:
    handler : Event -> string -> unit

Modifiers: inline

⚠ OS Compatibility: WIN ❌ | MAC ✔ | LIN ❌ | MAS ❌

Emitted when dragged text is dropped in the tray icon.

handler : Event -> string -> unit

this.onMiddleClick handler

Full Usage: this.onMiddleClick handler

Parameters:
Modifiers: inline

⚠ OS Compatibility: WIN ✔ | MAC ❌ | LIN ❌ | MAS ❌

Emitted when the tray icon is middle clicked.

handler : IOnMiddleClick -> unit

this.onMiddleClick handler

Full Usage: this.onMiddleClick handler

Parameters:
Modifiers: inline

⚠ OS Compatibility: WIN ✔ | MAC ❌ | LIN ❌ | MAS ❌

Emitted when the tray icon is middle clicked.

handler : KeyboardEvent -> Rectangle -> unit

this.onMouseDown handler

Full Usage: this.onMouseDown handler

Parameters:
Modifiers: inline

⚠ OS Compatibility: WIN ❌ | MAC ✔ | LIN ❌ | MAS ❌

Emitted when the mouse clicks the tray icon.

handler : IOnMouseDown -> unit

this.onMouseDown handler

Full Usage: this.onMouseDown handler

Parameters:
Modifiers: inline

⚠ OS Compatibility: WIN ❌ | MAC ✔ | LIN ❌ | MAS ❌

Emitted when the mouse clicks the tray icon.

handler : KeyboardEvent -> Point -> unit

this.onMouseEnter handler

Full Usage: this.onMouseEnter handler

Parameters:
Modifiers: inline

⚠ OS Compatibility: WIN ✔ | MAC ✔ | LIN ❌ | MAS ❌

Emitted when the mouse enters the tray icon.

handler : IOnMouseEnter -> unit

this.onMouseEnter handler

Full Usage: this.onMouseEnter handler

Parameters:
Modifiers: inline

⚠ OS Compatibility: WIN ✔ | MAC ✔ | LIN ❌ | MAS ❌

Emitted when the mouse enters the tray icon.

handler : KeyboardEvent -> Point -> unit

this.onMouseLeave handler

Full Usage: this.onMouseLeave handler

Parameters:
Modifiers: inline

⚠ OS Compatibility: WIN ✔ | MAC ✔ | LIN ❌ | MAS ❌

Emitted when the mouse exits the tray icon.

handler : IOnMouseLeave -> unit

this.onMouseLeave handler

Full Usage: this.onMouseLeave handler

Parameters:
Modifiers: inline

⚠ OS Compatibility: WIN ✔ | MAC ✔ | LIN ❌ | MAS ❌

Emitted when the mouse exits the tray icon.

handler : KeyboardEvent -> Point -> unit

this.onMouseMove handler

Full Usage: this.onMouseMove handler

Parameters:
Modifiers: inline

⚠ OS Compatibility: WIN ✔ | MAC ✔ | LIN ❌ | MAS ❌

Emitted when the mouse moves in the tray icon.

handler : IOnMouseMove -> unit

this.onMouseMove handler

Full Usage: this.onMouseMove handler

Parameters:
Modifiers: inline

⚠ OS Compatibility: WIN ✔ | MAC ✔ | LIN ❌ | MAS ❌

Emitted when the mouse moves in the tray icon.

handler : KeyboardEvent -> Point -> unit

this.onMouseUp handler

Full Usage: this.onMouseUp handler

Parameters:
Modifiers: inline

⚠ OS Compatibility: WIN ❌ | MAC ✔ | LIN ❌ | MAS ❌

Emitted when the mouse is released from clicking the tray icon.> [!NOTE] This will not be emitted if you have set a context menu for your Tray using tray.setContextMenu, as a result of macOS-level constraints.

handler : IOnMouseUp -> unit

this.onMouseUp handler

Full Usage: this.onMouseUp handler

Parameters:
Modifiers: inline

⚠ OS Compatibility: WIN ❌ | MAC ✔ | LIN ❌ | MAS ❌

Emitted when the mouse is released from clicking the tray icon.> [!NOTE] This will not be emitted if you have set a context menu for your Tray using tray.setContextMenu, as a result of macOS-level constraints.

handler : KeyboardEvent -> Point -> unit

this.onRightClick handler

Full Usage: this.onRightClick handler

Parameters:
Modifiers: inline

⚠ OS Compatibility: WIN ✔ | MAC ✔ | LIN ❌ | MAS ❌

Emitted when the tray icon is right clicked.

handler : IOnRightClick -> unit

this.onRightClick handler

Full Usage: this.onRightClick handler

Parameters:
Modifiers: inline

⚠ OS Compatibility: WIN ✔ | MAC ✔ | LIN ❌ | MAS ❌

Emitted when the tray icon is right clicked.

handler : KeyboardEvent -> Rectangle -> unit

this.onceBalloonClick handler

Full Usage: this.onceBalloonClick handler

Parameters:
    handler : unit -> unit

Modifiers: inline

⚠ OS Compatibility: WIN ✔ | MAC ❌ | LIN ❌ | MAS ❌

Emitted when the tray balloon is clicked.

handler : unit -> unit

this.onceBalloonClosed handler

Full Usage: this.onceBalloonClosed handler

Parameters:
    handler : unit -> unit

Modifiers: inline

⚠ OS Compatibility: WIN ✔ | MAC ❌ | LIN ❌ | MAS ❌

Emitted when the tray balloon is closed because of timeout or user manually closes it.

handler : unit -> unit

this.onceBalloonShow handler

Full Usage: this.onceBalloonShow handler

Parameters:
    handler : unit -> unit

Modifiers: inline

⚠ OS Compatibility: WIN ✔ | MAC ❌ | LIN ❌ | MAS ❌

Emitted when the tray balloon shows.

handler : unit -> unit

this.onceClick handler

Full Usage: this.onceClick handler

Parameters:
Modifiers: inline

Emitted when the tray icon is clicked.Note that on Linux this event is emitted when the tray icon receives an activation, which might not necessarily be left mouse click.

handler : IOnClick -> unit

this.onceClick handler

Full Usage: this.onceClick handler

Parameters:
Modifiers: inline

Emitted when the tray icon is clicked.Note that on Linux this event is emitted when the tray icon receives an activation, which might not necessarily be left mouse click.

handler : KeyboardEvent -> Rectangle -> Point -> unit

this.onceDoubleClick handler

Full Usage: this.onceDoubleClick handler

Parameters:
Modifiers: inline

⚠ OS Compatibility: WIN ✔ | MAC ✔ | LIN ❌ | MAS ❌

Emitted when the tray icon is double clicked.

handler : IOnDoubleClick -> unit

this.onceDoubleClick handler

Full Usage: this.onceDoubleClick handler

Parameters:
Modifiers: inline

⚠ OS Compatibility: WIN ✔ | MAC ✔ | LIN ❌ | MAS ❌

Emitted when the tray icon is double clicked.

handler : KeyboardEvent -> Rectangle -> unit

this.onceDragEnd handler

Full Usage: this.onceDragEnd handler

Parameters:
    handler : unit -> unit

Modifiers: inline

⚠ OS Compatibility: WIN ❌ | MAC ✔ | LIN ❌ | MAS ❌

Emitted when a drag operation ends on the tray or ends at another location.

handler : unit -> unit

this.onceDragEnter handler

Full Usage: this.onceDragEnter handler

Parameters:
    handler : unit -> unit

Modifiers: inline

⚠ OS Compatibility: WIN ❌ | MAC ✔ | LIN ❌ | MAS ❌

Emitted when a drag operation enters the tray icon.

handler : unit -> unit

this.onceDragLeave handler

Full Usage: this.onceDragLeave handler

Parameters:
    handler : unit -> unit

Modifiers: inline

⚠ OS Compatibility: WIN ❌ | MAC ✔ | LIN ❌ | MAS ❌

Emitted when a drag operation exits the tray icon.

handler : unit -> unit

this.onceDrop handler

Full Usage: this.onceDrop handler

Parameters:
    handler : unit -> unit

Modifiers: inline

⚠ OS Compatibility: WIN ❌ | MAC ✔ | LIN ❌ | MAS ❌

Emitted when any dragged items are dropped on the tray icon.

handler : unit -> unit

this.onceDropFiles handler

Full Usage: this.onceDropFiles handler

Parameters:
Modifiers: inline

⚠ OS Compatibility: WIN ❌ | MAC ✔ | LIN ❌ | MAS ❌

Emitted when dragged files are dropped in the tray icon.

handler : IOnDropFiles -> unit

this.onceDropFiles handler

Full Usage: this.onceDropFiles handler

Parameters:
    handler : Event -> string[] -> unit

Modifiers: inline

⚠ OS Compatibility: WIN ❌ | MAC ✔ | LIN ❌ | MAS ❌

Emitted when dragged files are dropped in the tray icon.

handler : Event -> string[] -> unit

this.onceDropText handler

Full Usage: this.onceDropText handler

Parameters:
Modifiers: inline

⚠ OS Compatibility: WIN ❌ | MAC ✔ | LIN ❌ | MAS ❌

Emitted when dragged text is dropped in the tray icon.

handler : IOnDropText -> unit

this.onceDropText handler

Full Usage: this.onceDropText handler

Parameters:
    handler : Event -> string -> unit

Modifiers: inline

⚠ OS Compatibility: WIN ❌ | MAC ✔ | LIN ❌ | MAS ❌

Emitted when dragged text is dropped in the tray icon.

handler : Event -> string -> unit

this.onceMiddleClick handler

Full Usage: this.onceMiddleClick handler

Parameters:
Modifiers: inline

⚠ OS Compatibility: WIN ✔ | MAC ❌ | LIN ❌ | MAS ❌

Emitted when the tray icon is middle clicked.

handler : IOnMiddleClick -> unit

this.onceMiddleClick handler

Full Usage: this.onceMiddleClick handler

Parameters:
Modifiers: inline

⚠ OS Compatibility: WIN ✔ | MAC ❌ | LIN ❌ | MAS ❌

Emitted when the tray icon is middle clicked.

handler : KeyboardEvent -> Rectangle -> unit

this.onceMouseDown handler

Full Usage: this.onceMouseDown handler

Parameters:
Modifiers: inline

⚠ OS Compatibility: WIN ❌ | MAC ✔ | LIN ❌ | MAS ❌

Emitted when the mouse clicks the tray icon.

handler : IOnMouseDown -> unit

this.onceMouseDown handler

Full Usage: this.onceMouseDown handler

Parameters:
Modifiers: inline

⚠ OS Compatibility: WIN ❌ | MAC ✔ | LIN ❌ | MAS ❌

Emitted when the mouse clicks the tray icon.

handler : KeyboardEvent -> Point -> unit

this.onceMouseEnter handler

Full Usage: this.onceMouseEnter handler

Parameters:
Modifiers: inline

⚠ OS Compatibility: WIN ✔ | MAC ✔ | LIN ❌ | MAS ❌

Emitted when the mouse enters the tray icon.

handler : IOnMouseEnter -> unit

this.onceMouseEnter handler

Full Usage: this.onceMouseEnter handler

Parameters:
Modifiers: inline

⚠ OS Compatibility: WIN ✔ | MAC ✔ | LIN ❌ | MAS ❌

Emitted when the mouse enters the tray icon.

handler : KeyboardEvent -> Point -> unit

this.onceMouseLeave handler

Full Usage: this.onceMouseLeave handler

Parameters:
Modifiers: inline

⚠ OS Compatibility: WIN ✔ | MAC ✔ | LIN ❌ | MAS ❌

Emitted when the mouse exits the tray icon.

handler : IOnMouseLeave -> unit

this.onceMouseLeave handler

Full Usage: this.onceMouseLeave handler

Parameters:
Modifiers: inline

⚠ OS Compatibility: WIN ✔ | MAC ✔ | LIN ❌ | MAS ❌

Emitted when the mouse exits the tray icon.

handler : KeyboardEvent -> Point -> unit

this.onceMouseMove handler

Full Usage: this.onceMouseMove handler

Parameters:
Modifiers: inline

⚠ OS Compatibility: WIN ✔ | MAC ✔ | LIN ❌ | MAS ❌

Emitted when the mouse moves in the tray icon.

handler : IOnMouseMove -> unit

this.onceMouseMove handler

Full Usage: this.onceMouseMove handler

Parameters:
Modifiers: inline

⚠ OS Compatibility: WIN ✔ | MAC ✔ | LIN ❌ | MAS ❌

Emitted when the mouse moves in the tray icon.

handler : KeyboardEvent -> Point -> unit

this.onceMouseUp handler

Full Usage: this.onceMouseUp handler

Parameters:
Modifiers: inline

⚠ OS Compatibility: WIN ❌ | MAC ✔ | LIN ❌ | MAS ❌

Emitted when the mouse is released from clicking the tray icon.> [!NOTE] This will not be emitted if you have set a context menu for your Tray using tray.setContextMenu, as a result of macOS-level constraints.

handler : IOnMouseUp -> unit

this.onceMouseUp handler

Full Usage: this.onceMouseUp handler

Parameters:
Modifiers: inline

⚠ OS Compatibility: WIN ❌ | MAC ✔ | LIN ❌ | MAS ❌

Emitted when the mouse is released from clicking the tray icon.> [!NOTE] This will not be emitted if you have set a context menu for your Tray using tray.setContextMenu, as a result of macOS-level constraints.

handler : KeyboardEvent -> Point -> unit

this.onceRightClick handler

Full Usage: this.onceRightClick handler

Parameters:
Modifiers: inline

⚠ OS Compatibility: WIN ✔ | MAC ✔ | LIN ❌ | MAS ❌

Emitted when the tray icon is right clicked.

handler : IOnRightClick -> unit

this.onceRightClick handler

Full Usage: this.onceRightClick handler

Parameters:
Modifiers: inline

⚠ OS Compatibility: WIN ✔ | MAC ✔ | LIN ❌ | MAS ❌

Emitted when the tray icon is right clicked.

handler : KeyboardEvent -> Rectangle -> unit

this.popUpContextMenu (?menu, ?position)

Full Usage: this.popUpContextMenu (?menu, ?position)

Parameters:
Modifiers: inline

⚠ OS Compatibility: WIN ✔ | MAC ✔ | LIN ❌ | MAS ❌

Pops up the context menu of the tray icon. When menu is passed, the menu will be shown instead of the tray icon's context menu.The position is only available on Windows, and it is (0, 0) by default.

?menu : Menu
?position : Point

this.removeBalloon ()

Full Usage: this.removeBalloon ()

Modifiers: inline

⚠ OS Compatibility: WIN ✔ | MAC ❌ | LIN ❌ | MAS ❌

Removes a tray balloon.

this.setContextMenu menu

Full Usage: this.setContextMenu menu

Parameters:
Modifiers: inline

Sets the context menu for this icon.

menu : Option<Menu>

this.setIgnoreDoubleClickEvents ignore

Full Usage: this.setIgnoreDoubleClickEvents ignore

Parameters:
    ignore : bool

Modifiers: inline

⚠ OS Compatibility: WIN ❌ | MAC ✔ | LIN ❌ | MAS ❌

Sets the option to ignore double click events. Ignoring these events allows you to detect every individual click of the tray icon.This value is set to false by default.

ignore : bool

this.setImage image

Full Usage: this.setImage image

Parameters:
Modifiers: inline

Sets the image associated with this tray icon.

image : U2<NativeImage, string>

this.setPressedImage image

Full Usage: this.setPressedImage image

Parameters:
Modifiers: inline

⚠ OS Compatibility: WIN ❌ | MAC ✔ | LIN ❌ | MAS ❌

Sets the image associated with this tray icon when pressed on macOS.

image : U2<NativeImage, string>

this.setTitle (title, ?fontType)

Full Usage: this.setTitle (title, ?fontType)

Parameters:
Modifiers: inline

⚠ OS Compatibility: WIN ❌ | MAC ✔ | LIN ❌ | MAS ❌

Sets the title displayed next to the tray icon in the status bar (Support ANSI colors).

title : string
?fontType : FontType

this.setToolTip toolTip

Full Usage: this.setToolTip toolTip

Parameters:
    toolTip : string

Modifiers: inline

Sets the hover text for this tray icon. Setting the text to an empty string will remove the tooltip.

toolTip : string

Type something to start searching.