Skip to main content
System tray icons let your application continue running without requiring a visible window. They are commonly used for messaging apps, clipboard managers, music players, background services, and utilities. Unlike creating a window directly, tray icons must be created through app.createTrayIcon(), which ensures they are initialized on the native event loop.

Before you begin

Tray icons should be created after the application is ready.

Creating your first tray icon

The example below creates a tray icon with two menu items.
After launching, your application will appear in the operating system’s notification area with a context menu.

Showing and hiding the window

Many tray applications hide instead of closing.
This produces the familiar behavior used by applications like Discord, Slack, and Spotify.

Updating the tray icon

You can replace the icon at runtime.
Or provide raw RGBA pixels.
This is useful for:
  • unread notifications
  • connection status
  • syncing indicators
  • recording state

Updating the tooltip

Changing the tooltip is an easy way to communicate application state without opening a window.

Replacing the menu

Menus are not fixed after creation.
This allows menus to reflect the application’s current state.

Responding to clicks

Tray icons emit pointer events.
Menu selections are handled separately through the application’s custom-menu-click event.

Temporarily hiding the tray icon

Hide the icon without destroying it.
All menu items and event listeners remain intact.

Removing the tray icon

To remove the icon permanently:
Calling app.exit() automatically disposes every tray icon owned by the application.

Platform differences

Some tray features are platform specific.

Next steps

The guide covers the most common workflows. For the complete API, available methods, events, and configuration options, see the TrayIcon API Reference.