notify_rs
Classes:
Desktop notification. |
|
A handle to a shown notification. |
|
Return value of |
Functions:
Get list of all capabilities of the running notification server. |
|
Returns a struct containing ServerInformation. |
-
class
Notification Bases:
objectDesktop notification.
Most fields are empty by default, only appname is initialized with the name of the current executable. The appname is used by some desktop environments to group notifications.
Methods:
appname(appname)Overwrite the appname field.
Set the icon field automatically.
body(body)Set the content of the body field.
finalize()Finalizes a Notification.
Filled by default with executable name.
get_body()Multiple lines possible, may support simple markup, check out get_capabilities() -> body-markup and body-hyperlinks.
get_icon()Use a
file://URI or a name in an icon theme.Subtitle for macOS
Single line to summarize the content.
Lifetime of the Notification in ms.
icon(icon)Set the icon field.
id(id)Sets the notification's ID.
image_path(path)Path to an image to use in the
image_datahint.show()Shows the notification.
subtitle(subtitle)Set the subtitle.
summary(summary)Set the summary.
timeout(timeout)Set the timeout.
urgency(urgency)Controls whether the notification is shown to the user while e.g.
-
auto_icon() Set the icon field automatically.
This looks at your binary’s name and uses it to set the icon.
Note
macOS does not have support manually setting the icon
- Return type
-
body(body) 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.
- Parameters
body –
str- Return type
-
finalize() Finalizes a Notification.
- Return type
-
get_body() Multiple lines possible, may support simple markup, check out get_capabilities() -> body-markup and body-hyperlinks.
- Return type
-
get_subtitle() Subtitle for macOS
-
get_timeout() Lifetime of the Notification in ms. Often not respected by server, sorry.
- Return type
-
icon(icon) 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 a file.
Note
macOS does not have support manually setting the icon
- Parameters
icon –
str- Return type
-
image_path(path) Path to an image to use in the
image_datahint.- Return type
-
show() Shows the notification.
- Return type
-
subtitle(subtitle) Set the subtitle.
This is only useful on macOS; It’s not part of the XDG specification.
- Return type
-
summary(summary) Set the summary.
Often acts as title of the notification. For more elaborate content use the body field.
- Return type
-
-
class
NotificationHandle Bases:
objectA handle to a shown notification.
Methods:
appname(appname)Overwrite the appname field.
Set the icon field automatically.
body(body)Set the content of the body field.
finalize()Finalizes a Notification.
Filled by default with executable name.
get_body()Multiple lines possible, may support simple markup, check out get_capabilities() -> body-markup and body-hyperlinks.
get_icon()Use a
file://URI or a name in an icon theme.Subtitle for macOS
Single line to summarize the content.
Lifetime of the Notification in ms.
icon(icon)Set the icon field.
image_path(path)Path to an image to use in the
image_datahint.show()Shows the notification.
subtitle(subtitle)Set the subtitle.
summary(summary)Set the summary.
timeout(timeout)Set the timeout.
urgency(urgency)Controls whether the notification is shown to the user while e.g.
-
auto_icon() Set the icon field automatically.
This looks at your binary’s name and uses it to set the icon.
Note
macOS does not have support manually setting the icon
- Return type
-
body(body) 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.
- Parameters
body –
str- Return type
-
finalize() Finalizes a Notification.
- Return type
-
get_body() Multiple lines possible, may support simple markup, check out get_capabilities() -> body-markup and body-hyperlinks.
- Return type
-
get_subtitle() Subtitle for macOS
-
get_timeout() Lifetime of the Notification in ms. Often not respected by server, sorry.
- Return type
-
icon(icon) 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 a file.
Note
macOS does not have support manually setting the icon
- Parameters
icon –
str- Return type
-
image_path(path) Path to an image to use in the
image_datahint.- Return type
-
show() Shows the notification.
On Windows this returns the
Notification; on Unix and other OSes it returns aNotificationHandle, which can be used to modify the notification later.
-
subtitle(subtitle) Set the subtitle.
This is only useful on macOS; It’s not part of the XDG specification.
- Return type
-
summary(summary) Set the summary.
Often acts as title of the notification. For more elaborate content use the body field.
- Return type
-
-
class
ServerInformation Bases:
objectReturn value of
get_server_information().Attributes:
The product name of the server.
The specification version the server is compliant with.
The vendor name.
The server's version string.
-
get_capabilities() Get list of all capabilities of the running notification server.
-
get_server_information() Returns a struct containing ServerInformation.
This struct contains name, vendor, version and spec_version of the notification server running.