Add windows notification support

This commit is contained in:
paoda
2020-05-31 00:00:54 -05:00
parent f95f0a846f
commit a918d79ac0
3 changed files with 439 additions and 47 deletions

View File

@@ -201,7 +201,39 @@ pub mod pomodoro {
#[cfg(target_os = "windows")]
fn notify(state: &State) {
unimplemented!();
use winrt_notification::{Duration, Sound, Toast};
let toast = Toast::new(Toast::POWERSHELL_APP_ID);
match state {
State::Work => {
toast
.title("Time to Work!")
.text1("Remember to stay focused!")
.sound(Some(Sound::Default))
.duration(Duration::Short)
.show()
.unwrap();
}
State::ShortBreak | State::LongBreak => {
toast
.title("Break Time!")
.text1("Enjoy your well deserved rest!")
.sound(Some(Sound::Default))
.duration(Duration::Short)
.show()
.unwrap();
}
State::Inactive => {
toast
.title("Pomodoro Cycle Complete.")
.text1("Now waiting for user input....")
.sound(Some(Sound::Default))
.duration(Duration::Short)
.show()
.unwrap();
}
}
}
}