Notifications#
- class ignis.services.notifications.NotificationService(*args: Any, **kwargs: Any)#
A notification daemon. Allow receiving notifications and perform actions on them.
- Signals:
"notified" (
Notification
): Emitted when a new notification appears."new_popup" (
Notification
): Emitted when a new popup notification appears. Only emitted ifdnd
is set toFalse
.
- Properties:
notifications (list[
Notification
], read-only): A list of all notifications.popups (list[
Notification
], read-only): A list of currently active popup notifications, sorted from newest to oldest.dnd (
bool
, read-write): Do Not Disturb mode. If set toTrue
, the"new_popup"
signal will not be emitted, and all newNotification
instances will havepopup
set toFalse
. Default:False
.popup_timeout (
int
, read-write): Timeout before a popup is automatically dismissed, in milliseconds. Default:5000
.max_popups_count (
int
, read-write): Maximum number of popups. If the length of thepopups
list exceedsmax_popups_count
, the oldest popup will be dismissed. Default:3
.
- Raises:
AnotherNotificationDaemonRunningError -- If another notification daemon is already running.
Example usage:
from ignis.services.notifications import NotificationsService notifications = NotificationsService.get_default() notifications.connect("notified", lambda x, notification: print(notification.app_name, notification.summary))
- get_notification(id: int) Notification | None #
Get
Notification
by ID.- Parameters:
id (
int
) -- ID of notification.- Returns:
Notification
orNone
- clear_all() None #
Clear all notifications.
- class ignis.services.notifications.Notification(*args: Any, **kwargs: Any)#
A notification object. Contain data about the notification and allows performing actions.
- Signals:
"closed" (): Emitted when notification has been closed.
"dismissed" (): Emitted when notification has been dismissed.
- Properties:
id (
int
, read-only): ID of the notification.app_name (
int
, read-only): Name of the application that sent the notification.icon (
str
, read-only): Icon name, path to image orNone
.summary (
int
, read-only): Summary text of the notification, usually the title.body (
int
, read-only): Body text of the notification, usually containing additional information.actions (list[
NotificationAction
], read-only): A list of actions associated with the notification.timeout (
int
, read-only): Timeout for the notification. Usually equal topopup_timeout
property of theNotificationService
unless the notification specifies otherwisetime (
float
, read-only): Time in POSIX format when the notification was sent.popup (
bool
, read-only):Whether the notification is a popup.
- class ignis.services.notifications.NotificationAction(*args: Any, **kwargs: Any)#
A simple object that contains data about a notification action.
- Properties:
id (
str
, read-only): The ID of the action.label (
int
, read-only): The label of the notification. This one should be displayed to user.
- invoke() None #
Invoke action.