| Crates.io | win32_notif |
| lib.rs | win32_notif |
| version | 0.10.5 |
| created_at | 2024-10-30 09:57:01.39925+00 |
| updated_at | 2026-01-24 07:47:50.444542+00 |
| description | Wrapper around Windows UWP XAML (WinRT) Notification api |
| homepage | |
| repository | https://github.com/AHQ-Softwares/win32_notif |
| max_upload_size | |
| id | 1428280 |
| size | 1,338,353 |
A lightweight crate to help you to compose beautiful notifications for Windows OS.
This crate aims for 100% coverage of the WinRT Toast api as much as possible.
Thankfully we are quite near that goal due to our unique approach to notification content: widgets
You declare your own style, however you like as long as the XML Supports it.
use std::{path::absolute, thread::sleep, time::Duration};
use win32_notif::{
NotificationBuilder, NotificationDataSet, notification::visual::{Image, Placement, Text, image::{AdaptiveImageAlign, ImageCrop}, text::HintStyle}, notifier::ToastsNotifier
};
fn main() {
let notifier = ToastsNotifier::new("Microsoft.Windows.Explorer").unwrap();
let notif = NotificationBuilder::new()
.visual(
Text::create(0, "Welcome to \"win32_notif\"!! 👋")
.align_center(true)
.wrap(true)
.with_style(HintStyle::Title)
)
.visual(
Text::create_binded(1, "desc")
.align_center(true)
.wrap(true)
.with_style(HintStyle::Body)
)
.value("desc", "Data binding works as well {WOW}!")
.build(0, ¬ifier, "01", "readme")
.unwrap();
notif.show()
.unwrap();
sleep(Duration::from_secs(1));
let data = NotificationDataSet::new().unwrap();
data.insert("desc", "Hello, the message is edited").unwrap();
notifier.update(&data, "readme", "01").unwrap();
}
We've actually implemented a lot of the Notification APIs
and a lot of other things... 🎉
...and that's it