Expand description
User notifications: one API on Linux, macOS and the web.
A Notification is shown under a stable tag: showing the same tag again
replaces it, and Notifier::withdraw takes it away. Where the platform keeps
notifications for an app that is not running, Notifier::schedule hands one
over for later. system is this target’s backend.
| Target | Backend |
|---|---|
| Linux | the connection the app’s session serves it (service); with host-portals, the notification portal or org.freedesktop.Notifications on the session bus instead |
| macOS | UNUserNotificationCenter, which needs the app bundle’s identifier: an unbundled binary answers NotifyError::Unavailable |
| Web | the Notifications API, while the page is open |
Modules§
- conformance
- The contract every
Notifierkeeps, as checks a backend’s tests run, plus aRecordingnotifier. - service
- The notification service an app’s session serves it: an app shows, replaces, withdraws and schedules notifications over the connection its launcher opened for it, and what the person does with one comes back on the same connection.
Structs§
- Alarm
Schedule - Alarm
State - Calendar
Alarm - An alarm in this device’s local time. Monday is bit zero; no weekdays means a single occurrence. A repeating alarm needs no network connection.
- Notification
- Notification
Button - Notification
Sender - Who a notification is from: their name, the stable id their face is drawn from, and whether they are an agent rather than a person.
- Priority
Contact - Scheduled
- System
Time - A measurement of the system clock, useful for talking to external entities like the file system or other processes.
Enums§
- Availability
- Close
Reason - Why the platform closed a notification the app showed, before the app took it
back itself, as
org.freedesktop.Notifications’NotificationClosednames it. - Feature
- Notify
Error - Severity
Constants§
Traits§
Functions§
- availability
- available
- publish_
priority_ contacts - Replace the people whose notifications break through Do Not Disturb with
contacts. Only the Tilo shell takes such a list, and only from an app it launched asapp_id(Feature::PriorityContacts). Blocks on the session bus: call it off the UI thread. - report_
activation - set_
activation_ handler - set_
close_ handler - Call
handlerwith the tag and reason of every notification whose tag starts withprefixthat the platform closes, on whatever thread reports it. Replaces an earlier handler forprefix; where prefixes nest, the longest one wins. - system
- This target’s notifications for the app
app_id. A desktop attributes notifications to an app, so without an id (a tool, a test, the shell) they are unavailable there; a browser attributes them to the page’s origin and needs none. - unavailable
- valid_
activation scheme:rest, the scheme as RFC 3986 spells it, without control characters or whitespace.