pub struct NotificationService {
pub notifications: Property<Vec<Arc<Notification>>>,
pub popups: Property<Vec<Arc<Notification>>>,
pub popup_duration: Property<u32>,
pub dnd: Property<bool>,
pub remove_expired: Property<bool>,
pub blocklist: Property<Vec<String>>,
/* private fields */
}Expand description
Desktop notification service. See crate-level docs for usage.
Fields§
§notifications: Property<Vec<Arc<Notification>>>All received notifications.
popups: Property<Vec<Arc<Notification>>>Currently visible popups.
popup_duration: Property<u32>Popup display duration in milliseconds.
dnd: Property<bool>Do Not Disturb mode; suppresses popups when true.
remove_expired: Property<bool>Auto-remove expired notifications.
blocklist: Property<Vec<String>>Glob patterns for blocking notifications by app name.
Implementations§
Source§impl NotificationService
impl NotificationService
Sourcepub async fn new() -> Result<Arc<Self>, Error>
pub async fn new() -> Result<Arc<Self>, Error>
Creates a new notification service instance.
§Errors
Returns error if D-Bus connection fails or service registration fails.
Sourcepub fn builder() -> NotificationServiceBuilder
pub fn builder() -> NotificationServiceBuilder
Creates a builder for configuring a NotificationService.
Sourcepub async fn dismiss_all(&self) -> Result<(), Error>
pub async fn dismiss_all(&self) -> Result<(), Error>
Dismisses all notifications and emits NotificationClosed for each.
§Errors
Returns error if the event channel is closed.
Sourcepub fn set_dnd(&self, dnd: bool)
pub fn set_dnd(&self, dnd: bool)
Sets the Do Not Disturb mode.
When enabled, new notifications will not appear as popups but will still be added to the notification list.
Sourcepub fn set_popup_duration(&self, duration: u32)
pub fn set_popup_duration(&self, duration: u32)
Sets the duration for how long popup notifications are displayed.
Sourcepub fn set_blocklist(&self, patterns: Vec<String>)
pub fn set_blocklist(&self, patterns: Vec<String>)
Replaces the blocklist patterns.
Sourcepub fn dismiss_popup(&self, id: u32)
pub fn dismiss_popup(&self, id: u32)
Removes a popup from the visible list without affecting notification history.
Cancels any running popup timer for this ID.
Sourcepub fn inhibit_popup(&self, id: u32)
pub fn inhibit_popup(&self, id: u32)
Pauses the popup countdown timer.
Sourcepub fn release_popup(&self, id: u32)
pub fn release_popup(&self, id: u32)
Resumes the popup countdown timer after a pause.