notification/
notification.rs1const APP_ID: &str = "rustydialogs.example.notify";
2
3fn main() {
4 rustydialogs::Notification::setup(APP_ID);
7
8 let i = std::process::id() / 4;
9
10 let icon = match i % 4 {
11 0 => rustydialogs::MessageIcon::Info,
12 1 => rustydialogs::MessageIcon::Warning,
13 2 => rustydialogs::MessageIcon::Error,
14 _ => rustydialogs::MessageIcon::Question,
15 };
16
17 let notify = rustydialogs::Notification {
18 app_id: APP_ID,
19 title: "Rusty Dialogs",
20 message: "This is a native notification.",
21 icon,
22 timeout: rustydialogs::Notification::SHORT_TIMEOUT,
23 };
24
25 notify.show();
26 println!("Notification shown");
27
28 std::thread::sleep(std::time::Duration::from_millis(100));
30}