winrt-toast

Crates.iowinrt-toast
lib.rswinrt-toast
version0.1.1
sourcesrc
created_at2022-08-13 10:23:56.975014
updated_at2022-08-14 09:32:58.696697
descriptionA toast notification library for Windows 10 and 11.
homepage
repositoryhttps://github.com/chengyuhui/kdeconnect-rs/tree/main/winrt-toast
max_upload_size
id644814
size36,978
Midori Kochiya (kmod-midori)

documentation

README

winrt-toast

A mostly usable binding to the Windows ToastNotification API.

Example

use winrt_toast::{Toast, Text, Header, ToastManager};
use winrt_toast::content::text::TextPlacement;

let manager = ToastManager::new(crate::AUM_ID);

let mut toast = Toast::new();
toast
    .text1("Title")
    .text2(Text::new("Body"))
    .text3(
        Text::new("Via SMS")
            .with_placement(TextPlacement::Attribution)
    );

manager.show(&toast).expect("Failed to show toast");

// Or you may add callbacks
manager.show_with_callbacks(
    &toast, None, None,
    Some(Box::new(move |e| {
        // This will be called if Windows fails to show the toast.
        eprintln!("Failed to show toast: {:?}", e);
    }))
).expect("Failed to show toast");

To-Do Features

  • Button style and tooltips in actions
  • Better callbacks
  • Sound
  • Adaptive contents and data binding
  • Groups and sub-groups
Commit count: 0

cargo fmt