rust-libnotify/examples/show.rs

18 lines
533 B
Rust
Raw Normal View History

extern crate libnotify;
fn main() {
// Init libnotify
2017-07-10 21:21:16 +00:00
libnotify::init("myapp");
2017-07-11 12:36:21 +00:00
// Create a new notification (doesn't show it yet)
2017-07-09 23:09:21 +00:00
let n =
2017-07-10 21:21:16 +00:00
libnotify::Notification::new("Summary", Some("Optional Body"), None);
// Show the notification
n.show().unwrap();
// You can also use the .show() convenience method on the context
n.update("I am another notification", None, None).unwrap();
// Show the update notification
n.show().unwrap();
// We are done, deinit
libnotify::uninit();
}