#notifications #tauri #toast #windows

tauri-winrt-notification

An incomplete wrapper over the WinRT toast api

14 unstable releases (6 breaking)

0.7.2 Apr 8, 2025
0.7.1 Feb 27, 2025
0.7.0 Oct 29, 2024
0.5.0 Jun 12, 2024
0.1.0 Aug 29, 2022

#505 in GUI

Download history 28972/week @ 2024-12-29 26152/week @ 2025-01-05 25450/week @ 2025-01-12 27859/week @ 2025-01-19 31887/week @ 2025-01-26 33430/week @ 2025-02-02 44676/week @ 2025-02-09 33293/week @ 2025-02-16 34538/week @ 2025-02-23 33140/week @ 2025-03-02 29045/week @ 2025-03-09 35254/week @ 2025-03-16 34025/week @ 2025-03-23 32986/week @ 2025-03-30 34885/week @ 2025-04-06 27434/week @ 2025-04-13

132,931 downloads per month
Used in 193 crates (via notify-rust)

MIT/Apache

47KB
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

~116MB
~2M SLoC