#notifications #toast #notify #winapi #power-shell

tauri-winrt-notification

An incomplete wrapper over the WinRT toast api

12 releases (6 breaking)

0.7.0 Oct 29, 2024
0.5.0 Jun 12, 2024
0.2.0 Mar 13, 2024
0.1.3 Oct 17, 2023
0.1.0 Aug 29, 2022

#93 in GUI

Download history 18296/week @ 2024-08-01 18547/week @ 2024-08-08 17333/week @ 2024-08-15 20429/week @ 2024-08-22 21607/week @ 2024-08-29 18425/week @ 2024-09-05 16795/week @ 2024-09-12 13871/week @ 2024-09-19 20241/week @ 2024-09-26 20041/week @ 2024-10-03 21322/week @ 2024-10-10 19598/week @ 2024-10-17 21079/week @ 2024-10-24 26471/week @ 2024-10-31 22472/week @ 2024-11-07 24054/week @ 2024-11-14

96,967 downloads per month
Used in 171 crates (via notify-rust)

MIT/Apache

46KB
532 lines

winrt-notification

license documentation

An incomplete wrapper over the WinRT toast api

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

Todo:

  • Add support for Adaptive Content

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]
tauri-winrt-notification = "0.5.1"

Examples

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

~128MB
~2M SLoC