pub struct NotificationHandle { /* private fields */ }
Expand description

A handle to a shown notification.

This keeps a connection alive to ensure actions work on certain desktops.

Implementations

Methods from Deref<Target = Notification>

Overwrite the appname field used for Notification.

Platform Support

Please note that this method has no effect on macOS. Here you can only set the application via set_application()

Set the summary.

Often acts as title of the notification. For more elaborate content use the body field.

Set the subtitle.

This is only useful on macOS, it’s not part of the XDG specification and will therefore be eaten by gremlins under your CPU 😈🤘.

Set the sound_name for the NSUserNotification

Set the content of the body field.

Multiline textual content of the notification. Each line should be treated as a paragraph. Simple html markup should be supported, depending on the server implementation.

Set the icon field.

You can use common icon names here, usually those in /usr/share/icons can all be used. You can also use an absolute path to file.

Platform support

macOS does not have support manually setting the icon. However you can pretend to be another app using set_application()

Set the icon field automatically.

This looks at your binary’s name and uses it to set the icon.

Platform support

macOS does not support manually setting the icon. However you can pretend to be another app using set_application()

Set the timeout.

This sets the time (in milliseconds) from the time the notification is displayed until it is closed again by the Notification Server. According to specification -1 will leave the timeout to be set by the server and 0 will cause the notification never to expire.

Platform support

This only works on XDG Desktops, macOS does not support manually setting the timeout.

👎 Deprecated:

please use .action() only

Set actions.

To quote http://www.galago-project.org/specs/notification/0.9/x408.html#command-notify

Actions are sent over as a list of pairs. Each even element in the list (starting at index 0) represents the identifier for the action. Each odd element in the list is the localized string that will be displayed to the user.

There is nothing fancy going on here yet. Careful! This replaces the internal list of actions!

(xdg only)

Add an action.

This adds a single action to the internal list of actions.

(xdg only)

Set an Id ahead of time

Setting the id ahead of time allows overriding a known other notification. Though if you want to update a notification, it is easier to use the update() method of the NotificationHandle object that show() returns.

(xdg only)

Finalizes a Notification.

Part of the builder pattern, returns a complete copy of the built notification.

Schedules a Notification

Sends a Notification at the specified timestamp. This is a raw f64, if that is a bit too raw for you please activate the feature "chrono", then you can use Notification::schedule() instead, which accepts a chrno::DateTime<T>.

Sends Notification to NSUserNotificationCenter.

Returns an Ok no matter what, since there is currently no way of telling the success of the notification.

Trait Implementations

Formats the value using the given formatter. Read more

The resulting type after dereferencing.

Dereferences the value.

Allow to easily modify notification properties

Mutably dereferences the value.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.