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(()) +}