ElectronTray
Unofficial
Electron Tray for adding icons and context menus to the system’s notification area.
Import:
import type { ElectronTray } from '@obsidian-typings/obsidian-catalyst-latest';Signature:
export class ElectronTrayMethods
| Method | Returns | Description | |
|---|---|---|---|
| addListener(event, listener) | this | Registers an event listener that is invoked when the tray balloon is clicked. win32 only. | |
| addListener(event, listener) | this | Registers an event listener that is invoked when the tray balloon is closed because of timeout or user manually closes it. win32 only. | |
| addListener(event, listener) | this | Registers an event listener that is invoked when the tray balloon shows. win32 only. | |
| addListener(event, listener) | this | Registers an event listener that is invoked when the tray icon is clicked. | |
| addListener(event, listener) | this | Registers an event listener that is invoked when the tray icon is double clicked. darwin and win32 only. | |
| addListener(event, listener) | this | Registers an event listener that is invoked when a drag operation ends on the tray or ends at another location. darwin only. | |
| addListener(event, listener) | this | Registers an event listener that is invoked when a drag operation enters the tray icon. darwin only. | |
| addListener(event, listener) | this | Registers an event listener that is invoked when a drag operation exits the tray icon. darwin only. | |
| addListener(event, listener) | this | Registers an event listener that is invoked when any dragged items are dropped on the tray icon. darwin only. | |
| addListener(event, listener) | this | Registers an event listener that is invoked when dragged files are dropped in the tray icon. darwin only. | |
| addListener(event, listener) | this | Registers an event listener that is invoked when dragged text is dropped in the tray icon. darwin only. | |
| addListener(event, listener) | this | Registers an event listener that is invoked when the mouse clicks the tray icon. darwin only. | |
| addListener(event, listener) | this | Registers an event listener that is invoked when the mouse enters the tray icon. darwin only. | |
| addListener(event, listener) | this | Registers an event listener that is invoked when the mouse exits the tray icon. darwin only. | |
| addListener(event, listener) | this | Registers an event listener that is invoked when the mouse moves in the tray icon. darwin and win32 only. | |
| addListener(event, listener) | this | Registers an event listener that is invoked 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 ElectronTray.setContextMenu, as a result of macOS-level constraints. darwin only. | |
| addListener(event, listener) | this | Registers an event listener that is invoked when the tray icon is right clicked. darwin and win32 only. | |
| closeContextMenu() | void | Closes an open context menu, as set by ElectronTray.setContextMenu. darwin and win32 only. | |
| destroy() | void | Destroys the tray icon immediately. | |
| displayBalloon(options) | void | Displays a tray balloon. win32 only. | |
| focus() | void | 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. win32 only. | |
| getBounds() | ElectronRectangle | The bounds of this tray icon. darwin and win32 only. | |
| getIgnoreDoubleClickEvents() | boolean | Whether double click events will be ignored. darwin only. | |
| getTitle() | string | The title displayed next to the tray icon in the status bar. darwin only. | |
| isDestroyed() | boolean | Whether the tray icon is destroyed. | |
| on('balloon-click', listener) | this | Registers a listener that is invoked when the tray balloon is clicked. win32 only. | |
| on('balloon-closed', listener) | this | Registers a listener that is invoked when the tray balloon is closed because of timeout or user manually closes it. win32 only. | |
| on('balloon-show', listener) | this | Registers a listener that is invoked when the tray balloon shows. win32 only. | |
| on('click', listener) | this | Registers a listener that is invoked when the tray icon is clicked. | |
| on('double-click', listener) | this | Registers a listener that is invoked when the tray icon is double clicked. darwin and win32 only. | |
| on('drag-end', listener) | this | Registers a listener that is invoked when a drag operation ends on the tray or ends at another location. darwin only. | |
| on('drag-enter', listener) | this | Registers a listener that is invoked when a drag operation enters the tray icon. darwin only. | |
| on('drag-leave', listener) | this | Registers a listener that is invoked when a drag operation exits the tray icon. darwin only. | |
| on('drop', listener) | this | Registers a listener that is invoked when any dragged items are dropped on the tray icon. darwin only. | |
| on('drop-files', listener) | this | Registers a listener that is invoked when dragged files are dropped in the tray icon. darwin only. | |
| on('drop-text', listener) | this | Registers a listener that is invoked when dragged text is dropped in the tray icon. darwin only. | |
| on('mouse-down', listener) | this | Registers a listener that is invoked when the mouse clicks the tray icon. darwin only. | |
| on('mouse-enter', listener) | this | Registers a listener that is invoked when the mouse enters the tray icon. darwin only. | |
| on('mouse-leave', listener) | this | Registers a listener that is invoked when the mouse exits the tray icon. darwin only. | |
| on('mouse-move', listener) | this | Registers a listener that is invoked when the mouse moves in the tray icon. darwin and win32 only. | |
| on('mouse-up', listener) | this | Registers a listener that is invoked 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 ElectronTray.setContextMenu, as a result of macOS-level constraints. darwin only. | |
| on('right-click', listener) | this | Registers a listener that is invoked when the tray icon is right clicked. darwin and win32 only. | |
| once(event, listener) | this | Registers a one-time listener that is invoked when the tray balloon is clicked. win32 only. | |
| once(event, listener) | this | Registers a one-time listener that is invoked when the tray balloon is closed because of timeout or user manually closes it. win32 only. | |
| once(event, listener) | this | Registers a one-time listener that is invoked when the tray balloon shows. win32 only. | |
| once(event, listener) | this | Registers a one-time listener that is invoked when the tray icon is clicked. | |
| once(event, listener) | this | Registers a one-time listener that is invoked when the tray icon is double clicked. darwin and win32 only. | |
| once(event, listener) | this | Registers a one-time listener that is invoked when a drag operation ends on the tray or ends at another location. darwin only. | |
| once(event, listener) | this | Registers a one-time listener that is invoked when a drag operation enters the tray icon. darwin only. | |
| once(event, listener) | this | Registers a one-time listener that is invoked when a drag operation exits the tray icon. darwin only. | |
| once(event, listener) | this | Registers a one-time listener that is invoked when any dragged items are dropped on the tray icon. darwin only. | |
| once(event, listener) | this | Registers a one-time listener that is invoked when dragged files are dropped in the tray icon. darwin only. | |
| once(event, listener) | this | Registers a one-time listener that is invoked when dragged text is dropped in the tray icon. darwin only. | |
| once(event, listener) | this | Registers a one-time listener that is invoked when the mouse clicks the tray icon. darwin only. | |
| once(event, listener) | this | Registers a one-time listener that is invoked when the mouse enters the tray icon. darwin only. | |
| once(event, listener) | this | Registers a one-time listener that is invoked when the mouse exits the tray icon. darwin only. | |
| once(event, listener) | this | Registers a one-time listener that is invoked when the mouse moves in the tray icon. darwin and win32 only. | |
| once(event, listener) | this | Registers a one-time listener that is invoked 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 ElectronTray.setContextMenu, as a result of macOS-level constraints. darwin only. | |
| once(event, listener) | this | Registers a one-time listener that is invoked when the tray icon is right clicked. darwin and win32 only. | |
| popUpContextMenu(menu?, position?) | void | 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. darwin and win32 only. | |
| removeBalloon() | void | Removes a tray balloon. win32 only. | |
| removeListener(event, listener) | this | Removes the event listener for the tray balloon being clicked. | |
| removeListener(event, listener) | this | Removes the event listener for the tray balloon being closed. | |
| removeListener(event, listener) | this | Removes the event listener for the tray balloon being shown. | |
| removeListener(event, listener) | this | Removes the event listener for the tray icon being clicked. | |
| removeListener(event, listener) | this | Removes the event listener for the tray icon being double clicked. | |
| removeListener(event, listener) | this | Removes the event listener for a drag operation ending. | |
| removeListener(event, listener) | this | Removes the event listener for a drag operation entering the tray icon. | |
| removeListener(event, listener) | this | Removes the event listener for a drag operation exiting the tray icon. | |
| removeListener(event, listener) | this | Removes the event listener for dragged items being dropped on the tray icon. | |
| removeListener(event, listener) | this | Removes the event listener for dragged files being dropped in the tray icon. | |
| removeListener(event, listener) | this | Removes the event listener for dragged text being dropped in the tray icon. | |
| removeListener(event, listener) | this | Removes the event listener for the mouse clicking the tray icon. | |
| removeListener(event, listener) | this | Removes the event listener for the mouse entering the tray icon. | |
| removeListener(event, listener) | this | Removes the event listener for the mouse exiting the tray icon. | |
| removeListener(event, listener) | this | Removes the event listener for the mouse moving in the tray icon. | |
| removeListener(event, listener) | this | Removes the event listener for the mouse being released from clicking the tray icon. | |
| removeListener(event, listener) | this | Removes the event listener for the tray icon being right clicked. | |
| setContextMenu(menu) | void | Sets the context menu for this icon. | |
| setIgnoreDoubleClickEvents(ignore) | void | Sets the option to ignore double click events. Ignoring these events allows you to detect every individual click of the tray icon. darwin only. | |
| setImage(image) | void | Sets the image associated with this tray icon. | |
| setPressedImage(image) | void | Sets the image associated with this tray icon when pressed on macOS. darwin only. | |
| setTitle(title, options?) | void | Sets the title displayed next to the tray icon in the status bar (Support ANSI colors). darwin only. | |
| setToolTip(toolTip) | void | Sets the hover text for this tray icon. |
Links to this page: