| 1 | #![allow(unused_imports, dead_code)] |
| 2 | use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::{threadrust-analyzer cargo std https://github.com/rust-lang/rust/library/std thread/::sleeprust-analyzer cargo std https://github.com/rust-lang/rust/library/std thread/functions/sleep()., timerust-analyzer cargo std https://github.com/rust-lang/rust/library/std time/::Durationrust-analyzer cargo core https://github.com/rust-lang/rust/library/core time/Duration#}; |
| 3 | |
| 4 | #[cfg(all(feature = "images_no_default_features", unix, not(target_os = "macos")))] |
| 5 | use notify_rustrust-analyzer cargo notify-rust 4.18.0 crate/::Imagerust-analyzer cargo notify-rust 4.18.0 image/Image#; |
| 6 | use notify_rustrust-analyzer cargo notify-rust 4.18.0 crate/::{Hintrust-analyzer cargo notify-rust 4.18.0 hints/Hint#, Notificationrust-analyzer cargo notify-rust 4.18.0 notification/Notification#, Urgencyrust-analyzer cargo notify-rust 4.18.0 urgency/Urgency#::*}; |
| 7 | |
| 8 | fn freezerust-analyzer cargo notify-rust 4.18.0 freeze().(message: &str) { |
| 9 | printlnrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/println!!("{message}\n"); |
| 10 | let mut _devnull = 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().(); |
| 11 | let _ = 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 _devnull); |
| 12 | } |
| 13 | |
| 14 | #[cfg(any(target_os = "windows", target_os = "macos"))] |
| 15 | fn main() { |
| 16 | printlnrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/println!!("this is an xdg only feature") |
| 17 | } |
| 18 | |
| 19 | #[cfg(all(unix, not(target_os = "macos")))] |
| 20 | fn mainrust-analyzer cargo notify-rust 4.18.0 main().() -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<(), Boxrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/Box#<dyn stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::errorrust-analyzer cargo std https://github.com/rust-lang/rust/library/std error/::Errorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core error/Error#>> { |
| 21 | printlnrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/println!!("Pay close attention to the output of:"); |
| 22 | printlnrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/println!!("$ dbus-monitor \"interface=org.freedesktop.Notifications\""); |
| 23 | |
| 24 | freezerust-analyzer cargo notify-rust 4.18.0 freeze().("actionicons"); |
| 25 | Notificationrust-analyzer cargo notify-rust 4.18.0 notification/Notification#::newrust-analyzer cargo notify-rust 4.18.0 notification/impl#[Notification]new().().hintrust-analyzer cargo notify-rust 4.18.0 notification/impl#[Notification]hint().(Hintrust-analyzer cargo notify-rust 4.18.0 hints/Hint#::ActionIconsrust-analyzer cargo notify-rust 4.18.0 hints/Hint#ActionIcons#(true)).showrust-analyzer cargo notify-rust 4.18.0 notification/impl#[Notification]show().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 26 | |
| 27 | freezerust-analyzer cargo notify-rust 4.18.0 freeze().("urgency: low, medium, high"); |
| 28 | Notificationrust-analyzer cargo notify-rust 4.18.0 notification/Notification#::newrust-analyzer cargo notify-rust 4.18.0 notification/impl#[Notification]new().() |
| 29 | .summaryrust-analyzer cargo notify-rust 4.18.0 notification/impl#[Notification]summary().("low") |
| 30 | .hintrust-analyzer cargo notify-rust 4.18.0 notification/impl#[Notification]hint().(Hintrust-analyzer cargo notify-rust 4.18.0 hints/Hint#::Urgencyrust-analyzer cargo notify-rust 4.18.0 hints/Hint#Urgency#(Lowrust-analyzer cargo notify-rust 4.18.0 urgency/Urgency#Low#)) |
| 31 | .showrust-analyzer cargo notify-rust 4.18.0 notification/impl#[Notification]show().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 32 | Notificationrust-analyzer cargo notify-rust 4.18.0 notification/Notification#::newrust-analyzer cargo notify-rust 4.18.0 notification/impl#[Notification]new().() |
| 33 | .summaryrust-analyzer cargo notify-rust 4.18.0 notification/impl#[Notification]summary().("normal") |
| 34 | .hintrust-analyzer cargo notify-rust 4.18.0 notification/impl#[Notification]hint().(Hintrust-analyzer cargo notify-rust 4.18.0 hints/Hint#::Urgencyrust-analyzer cargo notify-rust 4.18.0 hints/Hint#Urgency#(Normalrust-analyzer cargo notify-rust 4.18.0 urgency/Urgency#Normal#)) |
| 35 | .showrust-analyzer cargo notify-rust 4.18.0 notification/impl#[Notification]show().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 36 | Notificationrust-analyzer cargo notify-rust 4.18.0 notification/Notification#::newrust-analyzer cargo notify-rust 4.18.0 notification/impl#[Notification]new().() |
| 37 | .summaryrust-analyzer cargo notify-rust 4.18.0 notification/impl#[Notification]summary().("critical") |
| 38 | .hintrust-analyzer cargo notify-rust 4.18.0 notification/impl#[Notification]hint().(Hintrust-analyzer cargo notify-rust 4.18.0 hints/Hint#::Urgencyrust-analyzer cargo notify-rust 4.18.0 hints/Hint#Urgency#(Criticalrust-analyzer cargo notify-rust 4.18.0 urgency/Urgency#Critical#)) |
| 39 | .showrust-analyzer cargo notify-rust 4.18.0 notification/impl#[Notification]show().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 40 | |
| 41 | freezerust-analyzer cargo notify-rust 4.18.0 freeze().("category"); |
| 42 | Notificationrust-analyzer cargo notify-rust 4.18.0 notification/Notification#::newrust-analyzer cargo notify-rust 4.18.0 notification/impl#[Notification]new().() |
| 43 | .hintrust-analyzer cargo notify-rust 4.18.0 notification/impl#[Notification]hint().(Hintrust-analyzer cargo notify-rust 4.18.0 hints/Hint#::Categoryrust-analyzer cargo notify-rust 4.18.0 hints/Hint#Category#("device.removed".intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().())) |
| 44 | .showrust-analyzer cargo notify-rust 4.18.0 notification/impl#[Notification]show().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 45 | |
| 46 | freezerust-analyzer cargo notify-rust 4.18.0 freeze().("DesktopEntry"); |
| 47 | Notificationrust-analyzer cargo notify-rust 4.18.0 notification/Notification#::newrust-analyzer cargo notify-rust 4.18.0 notification/impl#[Notification]new().() |
| 48 | .summaryrust-analyzer cargo notify-rust 4.18.0 notification/impl#[Notification]summary().("desktop entry") |
| 49 | .hintrust-analyzer cargo notify-rust 4.18.0 notification/impl#[Notification]hint().(Hintrust-analyzer cargo notify-rust 4.18.0 hints/Hint#::DesktopEntryrust-analyzer cargo notify-rust 4.18.0 hints/Hint#DesktopEntry#("firefox".intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().())) |
| 50 | .showrust-analyzer cargo notify-rust 4.18.0 notification/impl#[Notification]show().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 51 | |
| 52 | freezerust-analyzer cargo notify-rust 4.18.0 freeze().("ImagePath"); |
| 53 | Notificationrust-analyzer cargo notify-rust 4.18.0 notification/Notification#::newrust-analyzer cargo notify-rust 4.18.0 notification/impl#[Notification]new().() |
| 54 | .summaryrust-analyzer cargo notify-rust 4.18.0 notification/impl#[Notification]summary().("iconpath") |
| 55 | .hintrust-analyzer cargo notify-rust 4.18.0 notification/impl#[Notification]hint().(Hintrust-analyzer cargo notify-rust 4.18.0 hints/Hint#::ImagePathrust-analyzer cargo notify-rust 4.18.0 hints/Hint#ImagePath#( |
| 56 | "/usr/share/icons/hicolor/128x128/apps/firefox.png".intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(), |
| 57 | )) |
| 58 | .showrust-analyzer cargo notify-rust 4.18.0 notification/impl#[Notification]show().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 59 | |
| 60 | freezerust-analyzer cargo notify-rust 4.18.0 freeze().("Resident"); |
| 61 | Notificationrust-analyzer cargo notify-rust 4.18.0 notification/Notification#::newrust-analyzer cargo notify-rust 4.18.0 notification/impl#[Notification]new().() |
| 62 | .summaryrust-analyzer cargo notify-rust 4.18.0 notification/impl#[Notification]summary().("resident") |
| 63 | .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)) |
| 64 | .showrust-analyzer cargo notify-rust 4.18.0 notification/impl#[Notification]show().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 65 | |
| 66 | freezerust-analyzer cargo notify-rust 4.18.0 freeze().("SoundFile"); |
| 67 | Notificationrust-analyzer cargo notify-rust 4.18.0 notification/Notification#::newrust-analyzer cargo notify-rust 4.18.0 notification/impl#[Notification]new().() |
| 68 | .summaryrust-analyzer cargo notify-rust 4.18.0 notification/impl#[Notification]summary().("soundfile") |
| 69 | .hintrust-analyzer cargo notify-rust 4.18.0 notification/impl#[Notification]hint().(Hintrust-analyzer cargo notify-rust 4.18.0 hints/Hint#::SoundFilerust-analyzer cargo notify-rust 4.18.0 hints/Hint#SoundFile#( |
| 70 | "/usr/share/sounds/alsa/Front_Left.wav".to_ownedrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc str/impl#[str][ToOwned]to_owned().(), |
| 71 | )) |
| 72 | .hintrust-analyzer cargo notify-rust 4.18.0 notification/impl#[Notification]hint().(Hintrust-analyzer cargo notify-rust 4.18.0 hints/Hint#::SoundNamerust-analyzer cargo notify-rust 4.18.0 hints/Hint#SoundName#("system sound".to_ownedrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc str/impl#[str][ToOwned]to_owned().())) |
| 73 | .hintrust-analyzer cargo notify-rust 4.18.0 notification/impl#[Notification]hint().(Hintrust-analyzer cargo notify-rust 4.18.0 hints/Hint#::SuppressSoundrust-analyzer cargo notify-rust 4.18.0 hints/Hint#SuppressSound#(false)) |
| 74 | .showrust-analyzer cargo notify-rust 4.18.0 notification/impl#[Notification]show().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 75 | |
| 76 | freezerust-analyzer cargo notify-rust 4.18.0 freeze().("Transient"); |
| 77 | Notificationrust-analyzer cargo notify-rust 4.18.0 notification/Notification#::newrust-analyzer cargo notify-rust 4.18.0 notification/impl#[Notification]new().() |
| 78 | .summaryrust-analyzer cargo notify-rust 4.18.0 notification/impl#[Notification]summary().("transient") |
| 79 | .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#(false)) |
| 80 | .showrust-analyzer cargo notify-rust 4.18.0 notification/impl#[Notification]show().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 81 | |
| 82 | freezerust-analyzer cargo notify-rust 4.18.0 freeze().("X and Y"); |
| 83 | Notificationrust-analyzer cargo notify-rust 4.18.0 notification/Notification#::newrust-analyzer cargo notify-rust 4.18.0 notification/impl#[Notification]new().() |
| 84 | .hintrust-analyzer cargo notify-rust 4.18.0 notification/impl#[Notification]hint().(Hintrust-analyzer cargo notify-rust 4.18.0 hints/Hint#::Xrust-analyzer cargo notify-rust 4.18.0 hints/Hint#X#(200)) |
| 85 | .hintrust-analyzer cargo notify-rust 4.18.0 notification/impl#[Notification]hint().(Hintrust-analyzer cargo notify-rust 4.18.0 hints/Hint#::Yrust-analyzer cargo notify-rust 4.18.0 hints/Hint#Y#(200)) |
| 86 | .showrust-analyzer cargo notify-rust 4.18.0 notification/impl#[Notification]show().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 87 | |
| 88 | #[cfg(all(feature = "images_no_default_features", unix, not(target_os = "macos")))] |
| 89 | { |
| 90 | freezerust-analyzer cargo notify-rust 4.18.0 freeze().("ImageData"); |
| 91 | let mut image_data = vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![0; 128 *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul(). 128 *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul(). 3]; |
| 92 | for i in 0..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#128 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul().128 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul().3 { |
| 93 | image_data[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`IndexMut<I>`]index_mut().i]rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`IndexMut<I>`]index_mut(). = (i rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Rem<Self>`]rem().%rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Rem<Self>`]rem(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Rem<Self>`]rem().256) as u8; |
| 94 | } |
| 95 | Notificationrust-analyzer cargo notify-rust 4.18.0 notification/Notification#::newrust-analyzer cargo notify-rust 4.18.0 notification/impl#[Notification]new().() |
| 96 | .hintrust-analyzer cargo notify-rust 4.18.0 notification/impl#[Notification]hint().(Hintrust-analyzer cargo notify-rust 4.18.0 hints/Hint#::ImageDatarust-analyzer cargo notify-rust 4.18.0 hints/Hint#ImageData#( |
| 97 | Imagerust-analyzer cargo notify-rust 4.18.0 image/Image#::from_rgbrust-analyzer cargo notify-rust 4.18.0 image/impl#[Image]from_rgb().(128, 128, image_data).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(), |
| 98 | )) |
| 99 | .summaryrust-analyzer cargo notify-rust 4.18.0 notification/impl#[Notification]summary().("You should see stripes in this notification"); |
| 100 | } |
| 101 | |
| 102 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(()) |
| 103 | |
| 104 | // freeze("Custom"); |
| 105 | // Notification::new().hint(Hint::Custom("foo","bar")).show(); |
| 106 | } |