1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
// Copyright 2017-2022 allenbenz <allenbenz@users.noreply.github.com>
// Copyright 2022-2022 Tauri Programme within The Commons Conservancy
// SPDX-License-Identifier: Apache-2.0
// SPDX-License-Identifier: MIT

use std::{process::exit, thread::sleep, time::Duration as StdDuration};

use tauri_winrt_notification::{Duration, Sound, Toast};

fn main() {
    Toast::new(Toast::POWERSHELL_APP_ID)
        .title("Look at this flip!")
        .text1("(╯°□°)╯︵ ┻━┻")
        .sound(Some(Sound::SMS))
        .duration(Duration::Short)
        .on_activated(handle_notification_click)
        .show()
        .expect("unable to send notification");
    println!("Waiting 10 seconds for the notification to be clicked...");
    sleep(StdDuration::from_secs(10));
    println!("The notification wasn't clicked!");
}

fn handle_notification_click() -> windows::core::Result<()> {
    println!("You've clicked me!");
    exit(0);
}