2 unstable releases

0.4.0 Nov 3, 2024
0.3.4 Nov 2, 2024
0.2.5 Oct 31, 2024

#46 in Windows APIs

Download history 828/week @ 2024-10-28 96/week @ 2024-11-04 9/week @ 2024-11-11

933 downloads per month

MIT license

51KB
1.5K SLoC

Win32 Notif

A lightweight crate to help you to compose beautiful notifications for Windows OS.

Usage

use win32_notif::{Notif, NotifIcon, NotifState, NotifType, NotifFlags};

fn main() {
  let notifier = ToastsNotifier::new("windows app user model id").unwrap();

  let notif = NotificationBuilder::new()
    .visual(Text::new(2, None, None, string!("Hello There 👋🏼")))
    .action(ActionButton::new(
      string!("Yes"),
      string!("yes"),
      ActivationType::Foreground,
      AfterActivationBehavior::Default,
      None,
      string!("yes"),
      HintButtonStyle::Success,
      string!("Yes"),
      false
    ))
    .build(2, &*NOTIFIER, "tag", "group")
    .unwrap();

  notif.show().unwrap();
}

lib.rs:

Win32 Notification

This library implements UWP XML Toast Notification This is a safe wrapper around the official C++ win32 apis

Example

use win32_notif::{
 notification::visual::progress::Progress,
 string, NotificationBuilder, ToastsNotifier,
};

fn main() {
  let notifier = ToastsNotifier::new("Microsoft.Windows.Explorer").unwrap();
  let notif = NotificationBuilder::new()
    .visual(Progress::new(
      None,
      string!("Downloading..."),
      string!("0.30"),
      None,
    ))
    .build(1, &notifier, "a", "ahq")
    .unwrap();

  let _ = notif.show();
  loop {}
}

Dependencies

~127MB
~2M SLoC