API
Methods for interacting with a ToDesktop application's tray icon.
Remarks
This package exposes a number of methods for interacting with a ToDesktop application's tray icon.
The tray icon is a part of the operating systems UI, located:
- at the right of the Menu Bar on macOS; - in the System Tray on Windows.
Functions
closeContextMenu()
Closes an open context menu, as set by tray.setContextMenu(). MacOS and Windows only.
Signature:
Parameters
Returns:
Promise<void>
create()
Creates a new Tray.
Signature:
Parameters
Returns:
Promise<Ref>
Identifier for the newly created Tray.
destroy()
Remove the app's tray item.
Signature:
Returns:
Promise<void>
destroy()
Signature:
Parameters
Returns:
Promise<void>
displayBalloon()
Displays a tray balloon on windows.
Signature:
Parameters
Returns:
Promise<void>
focus()
Returns focus to the taskbar notification area. Windows only.
Signature:
Parameters
Returns:
Promise<void>
getBounds()
The bounds of this tray icon as Object. MacOS and Windows only.
Signature:
Parameters
Returns:
Promise<Electron.Rectangle>
getIgnoreDoubleClickEvents()
Whether double click events will be ignored.
Signature:
Parameters
Returns:
Promise<boolean>
getTitle()
Gets the title displayed next to the tray icon in the status bar.
Signature:
Parameters
Returns:
Promise<string>
isDestroyed()
Whether the tray icon is destroyed.
Signature:
Parameters
Returns:
Promise<boolean>
popUpContextMenu()
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. MacOS and Windows only.
Signature:
Parameters
Returns:
Promise<void>
removeBalloon()
Removes a tray balloon.
Signature:
Parameters
Returns:
Promise<void>
setContextMenu()
Sets the context menu for this icon.
Signature:
Parameters
Returns:
Promise<void>
setIgnoreDoubleClickEvents()
Sets the option to ignore double click events. Ignoring these events allows you to detect every individual click of the tray icon.
Signature:
Parameters
Returns:
Promise<void>
setImage()
Sets the image associated with this tray icon.
Signature:
Parameters
Returns:
Promise<void>
setPressedImage()
Sets the image associated with this tray icon when pressed on macOS.
Signature:
Parameters
Returns:
Promise<void>
setTitle()
Set the title of the app's tray item.
Signature:
Parameters
Returns:
Promise<void>
setTitle()
Signature:
Parameters
Returns:
Promise<void>
setToolTip()
Sets the hover text for this tray icon.
Signature:
Parameters
Returns:
Promise<void>
Variables
on
Subcribes to an event on a tray object.
Signature:
removeAllListeners
Unsubscribes all tray objects from the event name.
Signature:
Type Aliases
TrayEvents
Signature: