Add windows notification support
This commit is contained in:
34
src/lib.rs
34
src/lib.rs
@@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user