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

tauri-winrt-notification

An incomplete wrapper over the WinRT toast api

11 releases (5 breaking)

0.6.0 Aug 15, 2024
0.5.0 Jun 12, 2024
0.4.0 May 30, 2024
0.2.0 Mar 13, 2024
0.1.0 Aug 29, 2022

#89 in GUI

Download history 12757/week @ 2024-06-12 12610/week @ 2024-06-19 15270/week @ 2024-06-26 12706/week @ 2024-07-03 14842/week @ 2024-07-10 14019/week @ 2024-07-17 20782/week @ 2024-07-24 17324/week @ 2024-07-31 19919/week @ 2024-08-07 17010/week @ 2024-08-14 19877/week @ 2024-08-21 20905/week @ 2024-08-28 19649/week @ 2024-09-04 16555/week @ 2024-09-11 14163/week @ 2024-09-18 18737/week @ 2024-09-25

73,193 downloads per month
Used in 166 crates (via notify-rust)

MIT/Apache

44KB
456 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

~129MB
~2M SLoC