Desktop notifications
Purpose
The core owns the org.freedesktop.Notifications session bus service so applications can notify as on any desktop shell, while the protected host draws popups and history as web UI.
Requirements
Requirement: No replacement of another daemon
The core SHALL ask for the bus name with DO_NOT_QUEUE and without REPLACE_EXISTING; if another daemon owns it, the state SHALL be blocked and the core MUST NOT replace it. Full text: section Decisions.
Scenario: Rival daemon
- WHEN another daemon such as GNOME Shell or dunst owns the name
- THEN the state is blocked and the history panel and system_context.notifications show it with the owner process name
Requirement: The agent does not read notification content
No model tool SHALL expose the history, popups or any notification text; system_context SHALL carry only state, reason, owner, doNotDisturb, count and unread. Full text: section Decisions.
Scenario: Agent asks for status
- WHEN the agent reads system_context.notifications
- THEN it gets only the status fields and no notification text
Requirement: History limits and storage
The core SHALL keep the last 100 notifications in notifications.json with file mode 0600 and atomic write, storing only id, app, summary, body, urgency, time and read plus doNotDisturb and the next identifier; actions and sender names are not stored and transient notifications leave no history. Full text: section Decisions.
Scenario: Restart
- WHEN the core restarts
- THEN every stored notification is closed, with no popup and no actions
Requirement: Do not disturb
Do not disturb SHALL hide non-critical popups, keep the history and keep counting unread; critical urgency (urgency = 2) SHALL still show and never expire, and the setting SHALL persist in the history file. Full text: section Decisions.
Scenario: Critical while on
- WHEN do not disturb is on and a critical notification arrives
- THEN the popup still shows and never expires
Requirement: Popup limit and focus
Popups SHALL show in a passive protected panel with keyboard false, up to 5 at once, newest first. Full text: section Decisions.
Scenario: Sixth popup
- WHEN more than 5 popups are pending
- THEN up to 5 show, newest first
Requirement: Plain text and size limits
Notification text SHALL be plain with markup and control characters removed, within limits of app 128, summary 256, body 2048 characters and 8 actions of 64 characters; a Notify string over 65536 characters MUST be refused with org.freedesktop.DBus.Error.InvalidArgs before parsing. Full text: section Bus contract.
Scenario: Oversized string
- WHEN a Notify string is longer than 65536 characters
- THEN it is refused with InvalidArgs before any parsing
Requirement: Expiry rules
Expiry SHALL be -1 for 6 s, 0 for never, a positive value capped at 60 s, and critical notifications SHALL never expire. Full text: section Bus contract.
Scenario: Default expiry
- WHEN expire_timeout is -1
- THEN the notification expires after 6 s
Requirement: Flood limit
More than 100 Notify calls in one second SHALL return org.freedesktop.Notifications.Error.ServerBusy. Full text: section Bus contract.
Scenario: Flood
- WHEN a client sends more than 100 Notify calls in one second
- THEN the extra calls return ServerBusy
Requirement: Strict D-Bus connections
The connections of the core SHALL be strict and MUST refuse, before sending, a call to a well-known name other than the bus daemon or a unique name; a reply counts only from the bus daemon or the unique name the call went to. Full text: section Bus contract.
Scenario: Call to another well-known name
- WHEN a core connection calls a well-known name other than the bus daemon
- THEN the call is refused before it is sent
Requirement: When the service starts
The core SHALL start the service only when AGENT_NATIVE_COMPOSITOR=smithay or AGENT_NATIVE_NOTIFICATIONS=1, SHALL stay off with AGENT_NATIVE_NOTIFICATIONS=0, and SHALL take the address only from DBUS_SESSION_BUS_ADDRESS with no fallback path. Full text: section When the service starts.
Scenario: No bus variable
- WHEN DBUS_SESSION_BUS_ADDRESS is not set
- THEN the core reports unavailable
Requirement: Notification strings render as text
The React module SHALL render every notification string as text and MUST NOT write HTML. Full text: section UI.
Scenario: HTML in a summary
- WHEN a notification summary contains markup
- THEN it is shown as text
Requirement: Routes need the host token
The notification routes SHALL require the token of the protected host, and the POST routes SHALL take exact typed input. Full text: section UI.
Scenario: Request without token
- WHEN a request lacks the host token
- THEN the route does not serve it
Requirement: Panel declarations are added once
A core of the real desktop SHALL append the missing protected panels to an existing valid web-panels.json once, keeping every existing entry and its order, and with the marker .web-panels-protected-v1 present MUST NOT add a panel again; an invalid or absent file is not written. Full text: section Panel declarations.
Scenario: User removed a panel
- WHEN the marker exists and the user removed a panel
- THEN the panel is not added again
Status
Doc status: current contract. The core is the notification server. Checked 2026-11-10.
Introduction
The core owns the org.freedesktop.Notifications service on the session bus.
Applications call it as they call any desktop shell (notify-send, libnotify,
GLib, browsers). The protected host draws the popups and the history as web UI.
Smithay only places the two windows. Status: implemented in the sources and
proved with a private bus and a synthetic core. It is not active in the shared
session until the next coordinated login. See Ax-Shell,
quick settings and web panels.
Decisions
- No replacement of another daemon. The core asks for the bus name with
DO_NOT_QUEUEand withoutREPLACE_EXISTING. If another daemon (for example GNOME Shell or dunst) owns the name, the state isblocked. The history panel andsystem_context.notificationsshow that state and the process name of the owner. The core retries every 30 seconds and at once when the owner leaves the bus. A lost bus connection is retried after at most 5 seconds. - The agent does not read notification content. No model tool exposes the
history, the popups or any text of a notification.
system_contexthas only the status (state,reason,owner,doNotDisturb,count,unread). The routes need the token of the protected host, and generated HTML never receives that token. The genericexecute_commandtool runs with the user privileges and can readnotifications.jsonlike any other file of the user. This change does not remove that existing authority. - History. The last 100 notifications stay in
<data dir>/notifications.json(file mode 0600, atomic write, the data directory is 0700). The file has onlyid,app,summary,body,urgency,timeandread, plusdoNotDisturband the next identifier. Actions and sender names are not stored. After a restart every stored notification is closed (no popup, no actions), because its client connection is gone. The user clears the history in the panel (Limpar tudo) or removes single entries. Transient notifications (transienthint) leave no history. A change of the bus state (active, blocked, unavailable) does not write the file; only a change of the history or of do-not-disturb does. - Bell. Since 2026-10-31 the bell and its badge sit at the center of the top bar, in one date control with the date and the time. The whole control opens the notification center 8px under the top bar, at the center. Without the notification service, the bell hides and keeps its space.
- Popups. Since 2026-10-31 they appear at the top center, 8px under the
top bar, like GNOME, in a passive protected panel (
notifications,keyboard: false). The declaration keeps the legacy default above the bottom bar (bottom-right, offsets 8/48), so a compositor without the top bar shows the popups next to the bell. While a top bar is mapped, Smithay places that exact default at the top center; existing configurations are not rewritten. Custom offsets and isolated panels keep their anchors. The notification center and quick settings also keep their legacy defaults (bottom-right, offsets 0/40), which Smithay moves under the top bar. The host window is shown withshowInactive()only while the page has content and it is hidden when the page is empty. Smithay does not give keyboard focus to a panel withkeyboard: false. Up to 5 popups show, newest first. - Do not disturb. It hides non-critical popups, keeps the history and keeps
counting unread notifications. Critical urgency (hint
urgency= 2) still shows and never expires. The setting persists in the history file.
Bus contract
| Item | Behavior |
|---|---|
| Methods | GetCapabilities (actions, body), Notify, CloseNotification, GetServerInformation (spec 1.2), plus Introspect and Peer |
| Signals | NotificationClosed(id, reason) with 1 expired, 2 dismissed, 3 closed by call, 4 undefined (trimmed from history). ActionInvoked(id, key) |
| Text | Markup is removed and the text is plain. Limits: app 128, summary 256, body 2048 characters, 8 actions of 64 characters. Control characters are removed. A Notify string longer than 65536 characters is refused with org.freedesktop.DBus.Error.InvalidArgs before any parsing, and each field is cut to four times its limit before the markup is removed, so the cost stays linear |
| Hints used | urgency, category, transient, resident. Images and icons are ignored, so the UI shows no remote or file images |
| Expiry | -1 uses 6 s, 0 never expires, a positive value is capped at 60 s, critical never expires |
| Replacement | replaces_id updates an existing notification and moves it to the top. Any client can replace or close an identifier, as in other desktop shells |
Action default |
A click on the card calls it. It has no button |
| Actions | After an action the notification closes with reason 2, unless the resident hint is set |
| Flood limit | More than 100 Notify calls in one second return org.freedesktop.Notifications.Error.ServerBusy |
The D-Bus client is web-shell/core/dbus.js: SASL EXTERNAL, little endian,
no file descriptors, messages up to 16 MiB (a larger one, up to the 128 MiB
of the specification, is dropped as it arrives: a method call gets
org.freedesktop.DBus.Error.LimitsExceeded, a waiting caller gets the error,
and the connection stays), dictionaries with string keys
become objects without a prototype. Nesting follows the specification: 32
arrays, 32 structures and 64 containers in total. A message that frames
correctly but does not decode is dropped: a method call gets
org.freedesktop.DBus.Error.InvalidArgs, a waiting caller gets the error, and
the connection and the bus name stay. Only a framing error (another
byte order or protocol version, or a message over 128 MiB) closes the
connection. A reply counts only from the bus daemon (which also answers for a call it
cannot deliver) or from the unique name the call went to; a reply from
another peer with the same serial is ignored. The connections of the core are strict:
they call only the bus daemon or a unique name, and a call to another
well-known name is refused before it is sent, so the tray calls the unique
owner of the watcher. A connection that is not strict (the test clients)
accepts any sender for a call to another well-known name.
A call that gets no reply in time fails with code ETIMEDOUT; a dropped reply
fails the call with EBADMSG (malformed) or EMSGSIZE (over 16 MiB). A
message over 16 MiB with a header over 64 KiB is skipped with no reply. A bus that does not finish the handshake in time has its socket
closed. It adds no npm dependency. The service is
web-shell/core/notifications.js and the HTTP actions are in
web-shell/core/notification-routes.js.
When the service starts
The core starts the service only when AGENT_NATIVE_COMPOSITOR=smithay (the
real desktop) or AGENT_NATIVE_NOTIFICATIONS=1. AGENT_NATIVE_NOTIFICATIONS=0
turns it off. The address comes only from DBUS_SESSION_BUS_ADDRESS. There is
no fallback path, so a core without that variable reports unavailable.
testEnvironment points DBUS_SESSION_BUS_ADDRESS at a path that does not
exist and removes AT_SPI_BUS_ADDRESS and PULSE_SERVER, so a synthetic core
never inherits the session bus, the accessibility bus or the audio server of
the user. Tests start their own bus with
startPrivateBus() (web-shell/scripts/private-bus.js).
UI
notifications.htmland.cssinvendor/interface/hostand the React modulenotifications.js(built fromui-src/host/notifications.jsxon the shared panel runtimeshadcn-panel.js, openspec/changes/archive/2026-11-02-heroui-migration/design.md, phase 3) draw two documents: the passive popups (/web-panel/notifications) and the history (/web-panel/notification-center). React renders every notification string as text; the module never writes HTML. Since 2026-11-06 the popup cards are dark in both system themes, like the chat and the other panels, with no blur and a stronger veil (openspec/specs/web-panels/spec.md). On a compositor withcapabilities.panelAlphaGlassthe popup page is transparent and each card takes the alpha glass of the compositor; the history stays one rounded surface at the height of its window, and only its list scrolls.- The bar has a bell button (
#notifications-open) with an unread badge. It dims while do not disturb is on and opens the history panel. The bar polls/api/notifications?view=summaryevery 4 seconds. - The history panel has Não perturbe (a switch: Space toggles it), Limpar tudo, a remove button per entry, action buttons for open notifications and the service state message. Opening it marks the notifications as read.
- Routes (host token required):
GET /api/notifications?view=history|popups|summary,GET /api/notifications/events(server-sent events with only a revision number), andPOST /api/notifications/{dismiss,remove,clear,read,action,dnd}with exact typed input.
Panel declarations
New installs get both panels from scripts/link-interface.py (and the core
uses the same declarations when no configuration file exists). A core of the
real desktop (the same condition that starts the service) appends the missing
protected panels (notifications, notification-center, volume-indicator)
to an existing valid web-panels.json once. It keeps every existing entry and
its order, uses the source_root of the quick-settings entry, writes the
file atomically with mode 0600, and then creates the marker
.web-panels-protected-v1 in the same directory. With the marker present it
never adds a panel again, so a panel that the user removes stays removed. An
invalid or absent file is not written. These are the entries (no new keys, so
the previous compositor accepts them as long as it already accepts
fit_content):
{ "id": "notifications", "title": "Notificações", "kind": "protected",
"source_root": "<checkout>/host", "anchor": "bottom-right", "width": 380,
"height": 480, "offset_x": 8, "offset_y": 48, "keyboard": false,
"auto_open": true, "close_on_blur": false, "fit_content": true },
{ "id": "notification-center", "title": "Notificações", "kind": "protected",
"source_root": "<checkout>/host", "anchor": "bottom-right", "width": 400,
"height": 560, "offset_x": 0, "offset_y": 40, "keyboard": true,
"auto_open": false, "close_on_blur": true, "fit_content": true }
source_root must be the host directory of the active checkout (the same
value as the quick-settings entry). The notifications panel needs
fit_content: true, because the host hides the window when the measured height
is zero.
Verification
Date: 2026-10-31, synthetic only.
test/dbus.test.js: encoding and decoding, hostile input, address parsing, and a client against a privatedbus-daemon.test/notifications.test.js: the service on a private bus, withbusctl(sd-bus) andgdbus(GDBus) as independent clients. It covers expiry, close reasons, actions, dismiss, remove, clear, the 100 limit, do not disturb with critical urgency, private file mode and reload, a corrupt file, a rival daemon, retry after the rival leaves, a missing bus, a lost connection, the flood limit and the absence of any model tool or content in the status.test/notifications-http.test.js: a synthetic core with a private bus. It checks the host token, events, actions that reach the client, the 0600 file, the panel documents, release of the bus name on shutdown, a core that is not enabled and a rival daemon.test/web-panels.test.js: protected panel assets, defaults and the hide and show cycle of the passive window with fake windows.- Browser: the real panel assets ran against a synthetic core with a private bus. Popups, the critical card, do not disturb, actions, dismissal, expiry, the history and the bar bell with a badge were exercised. The notification text was synthetic.
Not proved: the Electron host and Smithay with these panels (hide and show of
the window, the position above the bar, no focus change, the compositor stacking
order), a real notifier such as notify-send (it could not connect to the
private socket in the test sandbox), the user session bus and activation in the
shared session.