Tray

open external class Tray : EventEmitter(source)

Inheritors

Constructors

Link copied to clipboard
constructor(image: NativeImage, guid: String = definedExternally)

Tray

constructor(image: String, guid: String = definedExternally)

Tray

Functions

Link copied to clipboard
fun addListener(event: TrayEvent.CLICK, listener: (event: KeyboardEvent, bounds: Rectangle, position: Point) -> Unit)
fun addListener(event: TrayEvent.DOUBLE_CLICK, listener: (event: KeyboardEvent, bounds: Rectangle) -> Unit)
fun addListener(event: TrayEvent.DROP, listener: Function<Unit>)
fun addListener(event: TrayEvent.DROP_FILES, listener: (event: Event<*>, ReadonlyArray<String>) -> Unit)
fun addListener(event: TrayEvent.DROP_TEXT, listener: (event: Event<*>, text: String) -> Unit)
fun addListener(event: TrayEvent.MIDDLE_CLICK, listener: (event: KeyboardEvent, bounds: Rectangle) -> Unit)
fun addListener(event: TrayEvent.MOUSE_DOWN, listener: (event: KeyboardEvent, position: Point) -> Unit)
fun addListener(event: TrayEvent.MOUSE_ENTER, listener: (event: KeyboardEvent, position: Point) -> Unit)
fun addListener(event: TrayEvent.MOUSE_LEAVE, listener: (event: KeyboardEvent, position: Point) -> Unit)
fun addListener(event: TrayEvent.MOUSE_MOVE, listener: (event: KeyboardEvent, position: Point) -> Unit)
fun addListener(event: TrayEvent.MOUSE_UP, listener: (event: KeyboardEvent, position: Point) -> Unit)
fun addListener(event: TrayEvent.RIGHT_CLICK, listener: (event: KeyboardEvent, bounds: Rectangle) -> Unit)
Link copied to clipboard

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

Link copied to clipboard
fun destroy()

Destroys the tray icon immediately.

Link copied to clipboard

Displays a tray balloon.

Link copied to clipboard
Link copied to clipboard
fun focus()

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.

Link copied to clipboard

The bounds of this tray icon as Object.

Link copied to clipboard

Whether double click events will be ignored.

Link copied to clipboard
Link copied to clipboard

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

Link copied to clipboard

Whether the tray icon is destroyed.

Link copied to clipboard
fun off(event: TrayEvent.BALLOON_CLICK, listener: Function<Unit>)
fun off(event: TrayEvent.BALLOON_CLOSED, listener: Function<Unit>)
fun off(event: TrayEvent.BALLOON_SHOW, listener: Function<Unit>)
fun off(event: TrayEvent.CLICK, listener: (event: KeyboardEvent, bounds: Rectangle, position: Point) -> Unit)
fun off(event: TrayEvent.DOUBLE_CLICK, listener: (event: KeyboardEvent, bounds: Rectangle) -> Unit)
fun off(event: TrayEvent.DRAG_END, listener: Function<Unit>)
fun off(event: TrayEvent.DRAG_ENTER, listener: Function<Unit>)
fun off(event: TrayEvent.DRAG_LEAVE, listener: Function<Unit>)
fun off(event: TrayEvent.DROP, listener: Function<Unit>)
fun off(event: TrayEvent.DROP_FILES, listener: (event: Event<*>, ReadonlyArray<String>) -> Unit)
fun off(event: TrayEvent.DROP_TEXT, listener: (event: Event<*>, text: String) -> Unit)
fun off(event: TrayEvent.MIDDLE_CLICK, listener: (event: KeyboardEvent, bounds: Rectangle) -> Unit)
fun off(event: TrayEvent.MOUSE_DOWN, listener: (event: KeyboardEvent, position: Point) -> Unit)
fun off(event: TrayEvent.MOUSE_ENTER, listener: (event: KeyboardEvent, position: Point) -> Unit)
fun off(event: TrayEvent.MOUSE_LEAVE, listener: (event: KeyboardEvent, position: Point) -> Unit)
fun off(event: TrayEvent.MOUSE_MOVE, listener: (event: KeyboardEvent, position: Point) -> Unit)
fun off(event: TrayEvent.MOUSE_UP, listener: (event: KeyboardEvent, position: Point) -> Unit)
fun off(event: TrayEvent.RIGHT_CLICK, listener: (event: KeyboardEvent, bounds: Rectangle) -> Unit)
Link copied to clipboard
fun on(event: TrayEvent.BALLOON_CLICK, listener: Function<Unit>)

Emitted when the tray balloon is clicked.

fun on(event: TrayEvent.BALLOON_CLOSED, listener: Function<Unit>)

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

fun on(event: TrayEvent.BALLOON_SHOW, listener: Function<Unit>)

Emitted when the tray balloon shows.

fun on(event: TrayEvent.CLICK, listener: (event: KeyboardEvent, bounds: Rectangle, position: Point) -> Unit)

Emitted when the tray icon is clicked.

fun on(event: TrayEvent.DOUBLE_CLICK, listener: (event: KeyboardEvent, bounds: Rectangle) -> Unit)

Emitted when the tray icon is double clicked.

fun on(event: TrayEvent.DRAG_END, listener: Function<Unit>)

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

fun on(event: TrayEvent.DRAG_ENTER, listener: Function<Unit>)

Emitted when a drag operation enters the tray icon.

fun on(event: TrayEvent.DRAG_LEAVE, listener: Function<Unit>)

Emitted when a drag operation exits the tray icon.

fun on(event: TrayEvent.DROP, listener: Function<Unit>)

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

fun on(event: TrayEvent.DROP_FILES, listener: (event: Event<*>, ReadonlyArray<String>) -> Unit)

Emitted when dragged files are dropped in the tray icon.

fun on(event: TrayEvent.DROP_TEXT, listener: (event: Event<*>, text: String) -> Unit)

Emitted when dragged text is dropped in the tray icon.

fun on(event: TrayEvent.MIDDLE_CLICK, listener: (event: KeyboardEvent, bounds: Rectangle) -> Unit)

Emitted when the tray icon is middle clicked.

fun on(event: TrayEvent.MOUSE_DOWN, listener: (event: KeyboardEvent, position: Point) -> Unit)

Emitted when the mouse clicks the tray icon.

fun on(event: TrayEvent.MOUSE_ENTER, listener: (event: KeyboardEvent, position: Point) -> Unit)

Emitted when the mouse enters the tray icon.

fun on(event: TrayEvent.MOUSE_LEAVE, listener: (event: KeyboardEvent, position: Point) -> Unit)

Emitted when the mouse exits the tray icon.

fun on(event: TrayEvent.MOUSE_MOVE, listener: (event: KeyboardEvent, position: Point) -> Unit)

Emitted when the mouse moves in the tray icon.

fun on(event: TrayEvent.MOUSE_UP, listener: (event: KeyboardEvent, position: Point) -> Unit)

Emitted when the mouse is released from clicking the tray icon.

fun on(event: TrayEvent.RIGHT_CLICK, listener: (event: KeyboardEvent, bounds: Rectangle) -> Unit)

Emitted when the tray icon is right clicked.

Link copied to clipboard
fun once(event: TrayEvent.BALLOON_CLICK, listener: Function<Unit>)
fun once(event: TrayEvent.BALLOON_CLOSED, listener: Function<Unit>)
fun once(event: TrayEvent.BALLOON_SHOW, listener: Function<Unit>)
fun once(event: TrayEvent.CLICK, listener: (event: KeyboardEvent, bounds: Rectangle, position: Point) -> Unit)
fun once(event: TrayEvent.DOUBLE_CLICK, listener: (event: KeyboardEvent, bounds: Rectangle) -> Unit)
fun once(event: TrayEvent.DRAG_END, listener: Function<Unit>)
fun once(event: TrayEvent.DRAG_ENTER, listener: Function<Unit>)
fun once(event: TrayEvent.DRAG_LEAVE, listener: Function<Unit>)
fun once(event: TrayEvent.DROP, listener: Function<Unit>)
fun once(event: TrayEvent.DROP_FILES, listener: (event: Event<*>, ReadonlyArray<String>) -> Unit)
fun once(event: TrayEvent.DROP_TEXT, listener: (event: Event<*>, text: String) -> Unit)
fun once(event: TrayEvent.MIDDLE_CLICK, listener: (event: KeyboardEvent, bounds: Rectangle) -> Unit)
fun once(event: TrayEvent.MOUSE_DOWN, listener: (event: KeyboardEvent, position: Point) -> Unit)
fun once(event: TrayEvent.MOUSE_ENTER, listener: (event: KeyboardEvent, position: Point) -> Unit)
fun once(event: TrayEvent.MOUSE_LEAVE, listener: (event: KeyboardEvent, position: Point) -> Unit)
fun once(event: TrayEvent.MOUSE_MOVE, listener: (event: KeyboardEvent, position: Point) -> Unit)
fun once(event: TrayEvent.MOUSE_UP, listener: (event: KeyboardEvent, position: Point) -> Unit)
fun once(event: TrayEvent.RIGHT_CLICK, listener: (event: KeyboardEvent, bounds: Rectangle) -> Unit)
Link copied to clipboard
fun popUpContextMenu(menu: Menu = definedExternally, position: Point = definedExternally)

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.

Link copied to clipboard

Removes a tray balloon.

Link copied to clipboard
fun removeListener(event: TrayEvent.CLICK, listener: (event: KeyboardEvent, bounds: Rectangle, position: Point) -> Unit)
fun removeListener(event: TrayEvent.DOUBLE_CLICK, listener: (event: KeyboardEvent, bounds: Rectangle) -> Unit)
fun removeListener(event: TrayEvent.DROP, listener: Function<Unit>)
fun removeListener(event: TrayEvent.DROP_FILES, listener: (event: Event<*>, ReadonlyArray<String>) -> Unit)
fun removeListener(event: TrayEvent.DROP_TEXT, listener: (event: Event<*>, text: String) -> Unit)
fun removeListener(event: TrayEvent.MIDDLE_CLICK, listener: (event: KeyboardEvent, bounds: Rectangle) -> Unit)
fun removeListener(event: TrayEvent.MOUSE_DOWN, listener: (event: KeyboardEvent, position: Point) -> Unit)
fun removeListener(event: TrayEvent.MOUSE_ENTER, listener: (event: KeyboardEvent, position: Point) -> Unit)
fun removeListener(event: TrayEvent.MOUSE_LEAVE, listener: (event: KeyboardEvent, position: Point) -> Unit)
fun removeListener(event: TrayEvent.MOUSE_MOVE, listener: (event: KeyboardEvent, position: Point) -> Unit)
fun removeListener(event: TrayEvent.MOUSE_UP, listener: (event: KeyboardEvent, position: Point) -> Unit)
fun removeListener(event: TrayEvent.RIGHT_CLICK, listener: (event: KeyboardEvent, bounds: Rectangle) -> Unit)
Link copied to clipboard
fun setContextMenu(menu: Menu?)

Sets the context menu for this icon.

Link copied to clipboard

Sets the option to ignore double click events. Ignoring these events allows you to detect every individual click of the tray icon.

Link copied to clipboard
fun setImage(image: NativeImage)
fun setImage(image: String)

Sets the image associated with this tray icon.

Link copied to clipboard
Link copied to clipboard

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

Link copied to clipboard
fun setTitle(title: String, options: TitleOptions = definedExternally)

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

Link copied to clipboard
fun setToolTip(toolTip: String)

Sets the hover text for this tray icon.