feat: add OS + in-app notification system
notify-rust for desktop notifications, NotificationCenter.svelte with bell icon, unread badge, history (max 100), 6 notification types. Extended notification store with history and type support.
This commit is contained in:
parent
c6836cecf3
commit
e8acd6c3d5
6 changed files with 560 additions and 12 deletions
31
v2/src-tauri/src/notifications.rs
Normal file
31
v2/src-tauri/src/notifications.rs
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
// Desktop notification support via notify-rust
|
||||
|
||||
use notify_rust::{Notification, Urgency};
|
||||
|
||||
/// Send an OS desktop notification.
|
||||
/// Fails gracefully if the notification daemon is unavailable.
|
||||
pub fn send_desktop_notification(
|
||||
title: &str,
|
||||
body: &str,
|
||||
urgency: &str,
|
||||
) -> Result<(), String> {
|
||||
let urgency_level = match urgency {
|
||||
"critical" => Urgency::Critical,
|
||||
"low" => Urgency::Low,
|
||||
_ => Urgency::Normal,
|
||||
};
|
||||
|
||||
match Notification::new()
|
||||
.summary(title)
|
||||
.body(body)
|
||||
.appname("BTerminal")
|
||||
.urgency(urgency_level)
|
||||
.show()
|
||||
{
|
||||
Ok(_) => Ok(()),
|
||||
Err(e) => {
|
||||
tracing::warn!("Desktop notification failed (daemon unavailable?): {e}");
|
||||
Ok(()) // Graceful — don't propagate to frontend
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue