| 1 | #[cfg(any(target_os = "windows", target_os = "macos"))] |
| 2 | fn main() { |
| 3 | println!("this is an xdg only feature") |
| 4 | } |
| 5 | |
| 6 | #[cfg(all(unix, not(target_os = "macos")))] |
| 7 | fn main() { |
| 8 | use notify_rust::{CloseReason, Notification}; |
| 9 | |
| 10 | zbus::block_on(async { |
| 11 | Notification::new() |
| 12 | .summary("Don't Mind me") |
| 13 | .hint(notify_rust::Hint::Transient(true)) |
| 14 | .body("I'll be gone soon enough.\nSorry for the inconvenience.") |
| 15 | .show_async() |
| 16 | .await |
| 17 | .unwrap() |
| 18 | .on_close(|reason: CloseReason| { |
| 19 | println!("the notification was closed reason: {reason:?}") |
| 20 | }); |
| 21 | |
| 22 | Notification::new() |
| 23 | .summary("Pick an option") |
| 24 | .body("Click one of the action buttons below.") |
| 25 | .action("option-a", "Option A") |
| 26 | .action("option-b", "Option B") |
| 27 | .show_async() |
| 28 | .await |
| 29 | .unwrap() |
| 30 | .wait_for_action_async(|action| { |
| 31 | println!("action invoked: {action:?}"); |
| 32 | }) |
| 33 | .await; |
| 34 | }) |
| 35 | } |