mirror of
https://github.com/szymon-jozef/libnotify-rs.git
synced 2026-10-27 19:20:43 +01:00
docs: add example show_notification
This commit is contained in:
23
examples/show_notification.rs
Normal file
23
examples/show_notification.rs
Normal file
@@ -0,0 +1,23 @@
|
||||
use libnotify_rs::{
|
||||
functions::{init, uninit},
|
||||
notification::Notification,
|
||||
};
|
||||
|
||||
fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
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(())
|
||||
}
|
||||
Reference in New Issue
Block a user