simple/
simple.rs

1use win32_notif::{
2  notification::{
3    actions::ActionButton,
4    group::{Group, SubGroup},
5    visual::{
6      text::{HintAlign, HintStyle},
7      Text,
8    },
9    Scenario,
10  },
11  NotificationBuilder, ToastsNotifier,
12};
13
14pub fn main() {
15  let notifier = ToastsNotifier::new("Microsoft.Windows.Explorer").unwrap();
16
17  let notification = NotificationBuilder::new()
18    .with_scenario(Scenario::IncomingCall)
19    .with_use_button_style(true)
20    .visual(
21      Group::new()
22        .with_subgroup(
23          SubGroup::new().with_visual(Text::create(0, "Hello World").with_style(HintStyle::Title)),
24        )
25        .with_subgroup(
26          SubGroup::new().with_visual(
27            Text::create(0, "Hello World x2")
28              .with_style(HintStyle::Header)
29              .with_align(HintAlign::Right),
30          ),
31        ),
32    )
33    .action(
34      ActionButton::create("Answer")
35        .with_tooltip("Answer")
36        .with_id("answer"),
37    )
38    .build(1, &notifier, "a", "ahq")
39    .expect("Error");
40
41  notification.show().expect("Not Sent");
42}