| 1 | #[cfg(any(target_os = "windows", target_os = "macos"))] |
| 2 | fn main() { |
| 3 | printlnrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/println!!("this is a xdg only feature") |
| 4 | } |
| 5 | |
| 6 | #[cfg(all(unix, not(target_os = "macos")))] |
| 7 | fn mainrust-analyzer cargo notify-rust 4.18.0 main().() { |
| 8 | use notify_rustrust-analyzer cargo notify-rust 4.18.0 crate/::*; |
| 9 | fn wait_for_keypressrust-analyzer cargo notify-rust 4.18.0 wait_for_keypress().(msg: &str) { |
| 10 | printlnrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/println!!("{}", msg); |
| 11 | stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::stdinrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/stdio/stdin().().read_linerust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/stdio/impl#[Stdin]read_line().(&mut Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]new().()).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(); |
| 12 | } |
| 13 | |
| 14 | let handle: NotificationHandlerust-analyzer cargo notify-rust 4.18.0 xdg/NotificationHandle# = Notificationrust-analyzer cargo notify-rust 4.18.0 notification/Notification#::newrust-analyzer cargo notify-rust 4.18.0 notification/impl#[Notification]new().() |
| 15 | .summaryrust-analyzer cargo notify-rust 4.18.0 notification/impl#[Notification]summary().("oh no") |
| 16 | .hintrust-analyzer cargo notify-rust 4.18.0 notification/impl#[Notification]hint().(Hintrust-analyzer cargo notify-rust 4.18.0 hints/Hint#::Transientrust-analyzer cargo notify-rust 4.18.0 hints/Hint#Transient#(true)) |
| 17 | .bodyrust-analyzer cargo notify-rust 4.18.0 notification/impl#[Notification]body().("I'll be here till you close me!") |
| 18 | .hintrust-analyzer cargo notify-rust 4.18.0 notification/impl#[Notification]hint().(Hintrust-analyzer cargo notify-rust 4.18.0 hints/Hint#::Residentrust-analyzer cargo notify-rust 4.18.0 hints/Hint#Resident#(true)) // does not work on kde |
| 19 | .timeoutrust-analyzer cargo notify-rust 4.18.0 notification/impl#[Notification]timeout().(Timeoutrust-analyzer cargo notify-rust 4.18.0 timeout/Timeout#::Neverrust-analyzer cargo notify-rust 4.18.0 timeout/Timeout#Never#) // works on kde and gnome |
| 20 | .showrust-analyzer cargo notify-rust 4.18.0 notification/impl#[Notification]show().() |
| 21 | .unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(); |
| 22 | |
| 23 | wait_for_keypressrust-analyzer cargo notify-rust 4.18.0 wait_for_keypress().("press to close notification"); |
| 24 | handle.closerust-analyzer cargo notify-rust 4.18.0 xdg/impl#[NotificationHandle]close().(); |
| 25 | wait_for_keypressrust-analyzer cargo notify-rust 4.18.0 wait_for_keypress().("press to exit"); |
| 26 | } |