#toast #notifications #notify #windows #winapi #action #image

tauri-winrt-notification

An incomplete wrapper over the WinRT toast api

6 releases

new 0.2.1 Apr 18, 2024
0.2.0 Mar 13, 2024
0.1.3 Oct 17, 2023
0.1.2 Jul 1, 2023
0.1.0 Aug 29, 2022

#33 in Audio

Download history 8536/week @ 2024-01-02 9430/week @ 2024-01-09 10771/week @ 2024-01-16 9688/week @ 2024-01-23 12631/week @ 2024-01-30 12793/week @ 2024-02-06 12937/week @ 2024-02-13 12275/week @ 2024-02-20 12380/week @ 2024-02-27 11120/week @ 2024-03-05 11687/week @ 2024-03-12 13402/week @ 2024-03-19 12765/week @ 2024-03-26 11648/week @ 2024-04-02 12174/week @ 2024-04-09 9993/week @ 2024-04-16

48,426 downloads per month
Used in 147 crates (2 directly)

MIT/Apache

43KB
371 lines

winrt-notification

license version Build Status

An incomplete wrapper over the WinRT toast api

Tested in Windows 10 and 8.1. Untested in Windows 8, might work.

0.5 Documentation

0.2 Documentation

Todo:

  • Add support for Adaptive Content
  • Add support for Actions

Known Issues:

  • Will not work for Windows 7.

Limitations:

  • Windows 8.1 only supports a single image, the last image (icon, hero, image) will be the one on the toast

Usage

#Cargo.toml
[dependencies]
winrt-notification = "0.5.1"

Examples

extern crate winrt_notification;
use 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)
        .show()
        .expect("unable to toast");
}
extern crate winrt_notification;
use std::path::Path;
use winrt_notification::{IconCrop, Toast};

fn main() {
    Toast::new("Your AppUserModeId")
        .hero(&Path::new("C:\\absolute\\path\\to\\image.jpeg"), "alt text")
        .icon(
            &Path::new("c:/this/style/works/too/image.png"),
            IconCrop::Circular,
            "alt text",
        )
        .title("Lots of pictures here")
        .text1("One above the text as the hero")
        .text2("One to the left as an icon, and several below")
        .image(&Path::new("c:/photos/sun.png"), "the sun")
        .image(&Path::new("c:/photos/moon.png"), "the moon")
        .sound(None) // will be silent
        .show()
        .expect("unable to toast");
}

Dependencies

~142MB
~2.5M SLoC