Notifications

Show a system notification (show_notification)

Purpose: Pop up a system notification on Windows / Linux (on Windows it appears in the Action Center / bottom-right corner; on Linux it goes through freedesktop org.freedesktop.Notifications / zbus), with a title, body, an optional icon, and buttons. Ideal for letting the user know a task has finished, that confirmation is needed, and so on.

C
int32_t show_notification(const NotificationParams* params);

What each NotificationParams field does

FieldPurpose
summaryTitle, required, the first thing the user sees.
bodyThe body text.
iconAbsolute disk path to the small icon.
timeoutHow long it stays (in milliseconds). Currently has no effect on Windows (the toast duration is decided by system settings); on Linux, <= 0 is decided by the notification service.
button1 / button2The button labels on the notification; clicking them triggers notification-action and similar events (see Event Types).
text3An extra line of supplementary text.
actionA parameter related to the notification action; it is passed into the system callback data.

Returns 1 if the notification was sent for display, 0 on failure. Supported on both Windows and Linux (on Linux it goes through freedesktop org.freedesktop.Notifications / zbus and also returns 1 on success).

Behavior

The library registers the application internally on the first notification; no separate registration call is needed. When the user clicks, dismisses or display fails, the main process receives the corresponding event via jade_on — see Event Types · Notification-related events.

Example (handle the result in the callback after calling from the C side):

C
NotificationParams p = { 0 };
p.summary = "Task complete";
p.body = "Processing has finished";
show_notification(&p);