lucasfernog / mac-notification-sys

✉️ A simple wrapper to deliver or schedule macOS Notifications in Rust

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

mac-notification-sys

Crates.io license version Crates.io

A simple wrapper to deliver or schedule macOS Notifications in Rust.

Usage

#Cargo.toml
[dependencies]
mac-notification-sys = "0.3"

Documentation

The documentation can be found here

Example

use mac_notification_sys::*;

fn main() {
    let bundle = get_bundle_identifier_or_default("firefox");
    set_application(&bundle).unwrap();

    send_notification(
        "Danger",
        Some("Will Robinson"),
        "Run away as fast as you can",
        None,
    )
    .unwrap();

    send_notification(
        "NOW",
        None,
        "Without subtitle",
        Some(Notification::new().sound("Blow")),
    )
    .unwrap();
}

TODO

  • Add timeout option so notifications can be auto-closed
  • Allow NSDictionary to hold various types (perhaps with a union?)
  • Switch to UserNotification if possible

Contributors

Thanks goes to these wonderful people:

About

✉️ A simple wrapper to deliver or schedule macOS Notifications in Rust


Languages

Language:Rust 62.9%Language:Objective-C 37.1%