From 8e9a9a83e6d403078c1c257d9e16e938c69c56c7 Mon Sep 17 00:00:00 2001 From: szymon Date: Wed, 30 Sep 2026 14:58:04 +0200 Subject: [PATCH] docs: add example show_notification --- examples/show_notification.rs | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 examples/show_notification.rs diff --git a/examples/show_notification.rs b/examples/show_notification.rs new file mode 100644 index 0000000..6305532 --- /dev/null +++ b/examples/show_notification.rs @@ -0,0 +1,23 @@ +use libnotify_rs::{ + functions::{init, uninit}, + notification::Notification, +}; + +fn main() -> Result<(), Box> { + init("I love coffee"); + let mut notify = Notification::new( + "Remember to drink coffe!", + "Coffee is very important for your mental health!", + None, + )?; + + notify.set_timeout(libnotify_rs::notification::Timeout::Custom(1000 * 10)); // 10 secs + notify.set_urgency(libnotify_rs::notification::Urgency::Critical); // coffee is very important + notify.set_category("Coffee")?; + + notify.show()?; + + uninit(); + + Ok(()) +}