Crate reuse_notifications [] [src]

Allows to reuse notifications created by notify-rust , replacing the contents of an already existing notification, instead of creating a new one.

Examples

Example for a single notification

use notify_rust::*;
use reuse_notification::ReuseNotification;

Notification::new()
    .summary("Firefox News")
    .body("This will almost look like a real firefox notification.")
    .icon("firefox")
    .timeout(Timeout::Milliseconds(6000))
    .reuse() // <-- instead of `show()`
    .unwrap();

Example for different reusable notifications

In order to overwrite a specific notification, provide a string to .reuse().

Future calls to .reuse() with the same string will replace the contents of the old notification with the new ones in the new notification instance.

use notify_rust::*;
use reuse_notification::ReuseNotification;

Notification::new()
    .summary("Firefox News")
    .body("This will almost look like a real firefox notification.")
    .icon("firefox")
    .timeout(Timeout::Milliseconds(6000))
    .reuse("firefox_notification") // <-- instead of `show()`
    .unwrap();

Notification::new()
    .summary("Other News")
    .body("This will almost look like a real firefox notification.")
    .icon("firefox")
    .timeout(Timeout::Milliseconds(6000))
    .reuse("other_notification") // <-- instead of `show()`
    .unwrap();

Notification::new()
    .summary("Firefox News 2")
    .body("This will reuse the previous 'firefox notification'.")
    .icon("firefox")
    .timeout(Timeout::Milliseconds(6000))
    .reuse("firefox_notification") // <-- instead of `show()`
    .unwrap();

Traits

ReuseNotification

Allows to reuse notifications created via notfy-rust.