From a679e677538456c5ef255f88c14b5ea55274ac56 Mon Sep 17 00:00:00 2001 From: "Henry.Huang" Date: Thu, 28 Mar 2024 05:49:31 +0800 Subject: [PATCH] update --- crates/rs-os/rs-cross/try-notify/Cargo.toml | 7 ++++++- crates/rs-os/rs-cross/try-notify/src/run4.rs | 20 ++++++++++++++++++++ 2 files changed, 26 insertions(+), 1 deletion(-) create mode 100644 crates/rs-os/rs-cross/try-notify/src/run4.rs diff --git a/crates/rs-os/rs-cross/try-notify/Cargo.toml b/crates/rs-os/rs-cross/try-notify/Cargo.toml index 89b4092..1483a27 100644 --- a/crates/rs-os/rs-cross/try-notify/Cargo.toml +++ b/crates/rs-os/rs-cross/try-notify/Cargo.toml @@ -12,7 +12,7 @@ chrono = { version = "0.4", optional = true } # # cli usage: -# - cargo run --bin rs-eth-scanner -- scan "http://abc.url" "0xxxxx" "deposit" "100" +# - cargo run -- --bin run2 # [[bin]] name = "run2" @@ -21,3 +21,8 @@ path = "src/run2.rs" [[bin]] name = "run3" path = "src/run3.rs" + +# sound +[[bin]] +name = "run4" +path = "src/run4.rs" diff --git a/crates/rs-os/rs-cross/try-notify/src/run4.rs b/crates/rs-os/rs-cross/try-notify/src/run4.rs new file mode 100644 index 0000000..2cc809f --- /dev/null +++ b/crates/rs-os/rs-cross/try-notify/src/run4.rs @@ -0,0 +1,20 @@ +#![allow(unused_must_use)] + +use notify_rust::Notification; + +#[cfg(target_os = "macos")] +static SOUND: &str = "Submarine"; + +#[cfg(all(unix, not(target_os = "macos")))] +static SOUND: &str = "message-new-instant"; + +#[cfg(target_os = "windows")] +static SOUND: &str = "Mail"; + +fn main() { + Notification::new() + .summary("notification with sound") + .sound_name(SOUND) + .show() + .unwrap(); +}