pub struct NotificationManager { /* private fields */ }Expand description
Manages the set of active desktop notifications.
Implementations§
Source§impl NotificationManager
impl NotificationManager
Sourcepub fn new(screen_width: usize, screen_height: usize) -> Self
pub fn new(screen_width: usize, screen_height: usize) -> Self
Create a new notification manager positioned in the top-right corner.
Sourcepub fn notify(
&mut self,
summary: String,
body: String,
urgency: NotificationUrgency,
app_name: String,
) -> u32
pub fn notify( &mut self, summary: String, body: String, urgency: NotificationUrgency, app_name: String, ) -> u32
Post a new notification. Returns the assigned notification ID.
Sourcepub fn dismiss_all(&mut self)
pub fn dismiss_all(&mut self)
Dismiss all active notifications.
Sourcepub fn tick(&mut self, current_tick: u64)
pub fn tick(&mut self, current_tick: u64)
Tick the notification manager: remove expired and dismissed entries.
Sourcepub fn visible_notifications(&self) -> Vec<&Notification>
pub fn visible_notifications(&self) -> Vec<&Notification>
Return references to the currently visible (non-dismissed, non-expired)
notifications, up to max_visible.
Sourcepub fn active_count(&self) -> usize
pub fn active_count(&self) -> usize
Return total count of active (non-dismissed, non-expired) notifications.
Sourcepub fn render_to_buffer(
&self,
buffer: &mut [u32],
buf_width: usize,
buf_height: usize,
current_tick: u64,
)
pub fn render_to_buffer( &self, buffer: &mut [u32], buf_width: usize, buf_height: usize, current_tick: u64, )
Render all visible toast notifications into a u32 pixel buffer.
The buffer is buf_width * buf_height pixels in BGRA format (one u32
per pixel). Toasts are rendered from the top-right corner, stacking
downward. Only pixels belonging to toast rectangles are written; the
caller is responsible for compositing this buffer as an overlay.