pub struct Notifications { /* private fields */ }Expand description
The notifications, from cx.notifications(). A clone is cheap and
shares the one server.
Implementations§
Source§impl Notifications
impl Notifications
Sourcepub fn list(&self) -> ReadSignal<Vec<Notification>>
pub fn list(&self) -> ReadSignal<Vec<Notification>>
Every notification kept, oldest first: the history, from arrival until it is dismissed, picked or closed by its app. A replaced one keeps its place.
Sourcepub fn popups(&self) -> ReadSignal<Vec<Notification>>
pub fn popups(&self) -> ReadSignal<Vec<Notification>>
The notifications still showing as popups, newest first. Each stays
for its timeout, and until dismissed when that is
Timeout::Never or it is Urgency::Critical. An expired one
stays in list, unless it is transient.
Sourcepub fn dismiss(&self, id: u32)
pub fn dismiss(&self, id: u32)
Takes notification id away, as the user’s close button does, and
tells its app. An unknown id is ignored.
Sourcepub fn invoke(&self, id: u32, key: &str)
pub fn invoke(&self, id: u32, key: &str)
Tells notification id’s app that the user picked its action
key, then takes it away unless it is resident. An unknown id or
key is logged.
Sourcepub fn on_closed(&self, handler: impl Fn(&Notification, CloseReason) + 'static)
pub fn on_closed(&self, handler: impl Fn(&Notification, CloseReason) + 'static)
Calls handler with each notification that leaves the history and
why, as Quickshell’s Notification.closed, for as long as the
context cx.notifications() was called on lives. It runs on the
main thread once the lists no longer show it. A popup that times out
stays in the history, so it hasn’t closed, unless it is transient.
If it panics, that is logged with where on_closed was called, and
it isn’t called again. Called on a handle whose context went, it
logs that and does nothing.