The Phosphor.Notifications toast framework: the transient notification popups a shell flashes when an app posts a notification. A toast anchors under the band of the window it concerns when the placement map knows that window, and falls back to a centred stack at the screen's top edge. Pure QML, themed through `phosphor-theme` and built on the `phosphor-shell-widgets` atoms.
Phase 3.4 deliverable per Lambent's docs/design/04-implementation-plan.md.
Own the lifecycle and layout of toasts: stack them at the screen's top edge (newest on top) or anchor them to the window they concern, show up to maxVisible at once in the screen stack and queue the rest, auto-dismiss each after a timeout (restarted when the pointer leaves), and animate in/out/reflow. Provide a seam where a rules service can suppress or retime toasts.
The framework owns presentation, queueing, and timing only. Notification ingest (the org.freedesktop.Notifications server) is a separate concern. The host feeds toasts in by calling show(). The toast demo wires phosphor-service-notifications to that call.
| Component | Role |
|---|---|
| ToastHost | The toast stack: screen-edge and window-anchored placement, queue beyond maxVisible, dismiss + promote, reveal/reflow transitions, per-app-rules seam. Takes screenName, placementMap, decoration and reports inputRects / anchoredCount. |
| Toast | A single toast card: optional image, app name, summary, rich-text body, close, urgency accent, hover-to-pause auto-dismiss. |
import Phosphor.Notifications
ToastHost {
id: toasts
anchors.fill: parent
maxVisible: 4
rules: dndRules // optional, see below
}
// when a notification arrives:
toasts.show({
appName: "Mail",
summary: "New message",
body: "From <b>Ada</b>", // StyledText markup
imageSource: "file:///.../avatar.png",
urgency: 1, // 0 low, 1 normal, 2 critical
timeout: 5000 // 0 = sticky
})show() returns the toast id, or -1 if a rule suppressed it. Dismiss with dismiss(id), and clear() removes everything (e.g. before a session lock). toastDismissed(id) fires whenever a toast leaves, whether it was visible or still queued.
Shipped. ToastHost and Toast are in the tree with a QtQuickTest suite and an acceptance demo (../../examples/phosphor-toast-demo/, fed by phosphor-service-notifications so notify-send raises a toast). The window-anchored placement landed with the spectrum identity work.