#desktop #notification #notify #linux #macos

notify-rust

Show desktop notifications (linux, bsd, mac). Pure Rust dbus client and server.

24 stable releases (3 major)

3.6.2 Aug 11, 2019
3.6.0 May 16, 2019
3.5.0 Oct 21, 2018
3.4.2 Aug 19, 2017
0.9.0 Jun 30, 2015

#6 in Unix APIs

Download history 86/week @ 2019-04-28 125/week @ 2019-05-05 185/week @ 2019-05-12 197/week @ 2019-05-19 159/week @ 2019-05-26 380/week @ 2019-06-02 203/week @ 2019-06-09 157/week @ 2019-06-16 575/week @ 2019-06-23 278/week @ 2019-06-30 211/week @ 2019-07-07 64/week @ 2019-07-14 125/week @ 2019-07-21 67/week @ 2019-07-28 143/week @ 2019-08-04

925 downloads per month
Used in 28 crates (26 directly)

MIT/Apache

69KB
1K SLoC

notify-rust

Travis license Crates.io version documentation

Shows desktop notifications. This implementation does not rely on libnotify, as it is using dbus-rs. Basic notification features are supported, more sophisticated functionality will follow. The API shown below should be stable.

[dependencies]
notify-rust = "3"

Requirements

  • rustc >= 1.31
  • linux, with libdbus (see dbus-rs)
  • macos
  • no windows support, yet

Examples

Example 1 (Simple Notification)

use notify_rust::Notification;
Notification::new()
    .summary("Firefox News")
    .body("This will almost look like a real firefox notification.")
    .icon("firefox")
    .show().unwrap();

Example 2 (Persistent Notification)

use notify_rust::Notification;
use notify_rust::NotificationHint as Hint;
Notification::new()
    .summary("Category:email")
    .body("This has nothing to do with emails.\nIt should not go away until you acknowledge it.")
    .icon("thunderbird")
    .appname("thunderbird")
    .hint(Hint::Category("email".to_owned()))
    .hint(Hint::Resident(true)) // this is not supported by all implementations
    .timeout(0) // this however is
    .show().unwrap();

Usage & Documentation

Please see the documentation for current examples.

Commandline tool

Checkout toastify, it exposes most of the functionality of the lib to the commandline.

macOS support

This library shines on linux and bsd, which is its original target platform. Lately it gained support for macOS thanks to mac-notification-sys. However this only includes a small subset of the current functionality, since NSNotifications don't have as many features. Please refer to the You are a versed macOS UI developer with mad Objective-C skillz? PRSV.

Dependencies

~0–790KB
~15K SLoC