LavaUI docs GitHub

class Notifications

Swift

final class Notifications

Desktop notifications, from the panel's side: what is on screen right now, and what a click on it does.

The Swift half of canvas's NotificationHost, and the same shape as StatusNotifierTray — poll on the frame loop, rebuild when the revision moves, forward the user's decisions back out. Everything that speaks D-Bus stays on the C++ side; everything that decides what a toast looks like stays above this.

Sources/LavaUI/Notifications.swift:13

Constructors

init(editor: Editor)

Starts serving org.freedesktop.Notifications through editor, unless another daemon already has the name (see isServing).

Sources/LavaUI/Notifications.swift:78

Properties

var isServing: Bool { get set }

Whether this panel is the session's notification daemon. False when something else already owns the name — dunst, or the desktop this is nested inside — in which case that daemon draws them and this shows nothing.

Sources/LavaUI/Notifications.swift:72

var nextExpiryMs: Int64? { get }

Milliseconds until poll next has a toast to retire, or nil if none is counting down. What a pump that sleeps between polls sleeps for.

Sources/LavaUI/Notifications.swift:103

var toasts: [Toast] { get set }

The live notifications, oldest first.

Sources/LavaUI/Notifications.swift:74

Methods

func activate(_ toast: Toast)

A click on the body: the default action if the sender offered one, and otherwise just gone.

Sources/LavaUI/Notifications.swift:111

func dismiss(_ toast: Toast)

Closes the toast, as dismissed by the user.

Sources/LavaUI/Notifications.swift:125

func dismissAll()

Closes every toast.

Sources/LavaUI/Notifications.swift:130

func invoke(_ toast: Toast, action: Toast.Action)

Presses one of the toast's buttons: tells the sender, then closes the toast.

Sources/LavaUI/Notifications.swift:120

@discardableResult func poll() -> Bool

Pumps the bus, retires what expired, and rebuilds when either changed.

Sources/LavaUI/Notifications.swift:91

func setPaused(_ paused: Bool)

Stops every countdown while the pointer is over the stack. A notification that vanishes mid-sentence is one the user has to guess at.

Sources/LavaUI/Notifications.swift:136

Types