Search guides and the APICtrl K
  1. API reference
  2. Native GUI

gfx/system_tray.h

An icon in the system tray (the notification area, the macOS menu bar's status items), and the desktop's own local notifications.

#include <sonore/gfx/system_tray.h>
On this page

Design notes

SystemTrayIconComponent

As in the reference it is a Component, and a click on the icon arrives as one: a left click as mouseDown (and onClick), a right click as contextMenu (and onRightClick), a double click with clickCount 2. Nothing is drawn by the tree; the image is handed to the OS.

Windows
Shell_NotifyIconW, version 4, on a hidden top-level window of its own -- top-level because the "TaskbarCreated" broadcast that says Explorer restarted (and every icon must be added again) reaches no message-only window. The icon is made from a Bitmap (straight alpha, as icons are). showInfoBubble is the balloon, which Windows 10 and 11 show as a toast.
macOS
NSStatusItem in the system status bar, its button's image made from the Bitmap (a template image when one is given), its action telling a left click from a right one by the current event. showInfoBubble goes through PushNotifications below.
Linux
UNAVAILABLE. The tray there is StatusNotifierItem, a D-Bus protocol: an object registered on the session bus answering property and method calls, which needs a D-Bus connection and loop this SDK does not carry. isAvailable() says so.

PushNotifications

The LOCAL half of the reference's class: post a notification from this program and hear when the user clicks it. Windows: the tray balloon (a toast) -- a full WinRT toast needs an AppUserModelID registered with a Start-menu shortcut, which is an installer's business, not a library's. macOS: UNUserNotificationCenter (which only works in a signed .app bundle). Linux: notify-send when it is on the PATH (no click is reported back). REMOTE push -- a server sending to a device -- needs APNs or FCM credentials and a server, and is not here: getDeviceToken() is empty.

RUN on Windows: the icon added, modified, given a balloon and removed, with every Shell_NotifyIcon result counted; clicks and the balloon's click delivered by the callback messages the shell sends; Explorer's restart. macOS compiled only; Linux reports itself unavailable.

Types 2

class SystemTrayIconComponent : public Component

An icon in the system tray. See the header for each platform; on Linux it is unavailable and every call does nothing.

Local notifications: post one, hear it clicked. The reference's PushNotifications without the remote half (see the header). One per process; message thread.

↑↓ to move↵ to openEvery public name in the headers, and every guide