Notifications#
- class ignis.services.notifications.NotificationService(*args: Any, **kwargs: Any)#
A notification daemon. Allow receiving notifications and perform actions on them.
- 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))
- notified(*args)#
Signal
Emitted when a new notification appears.
- Parameters:
notification (
Notification
) -- The instance of the notification.
- new_popup(*args)#
Signal
Emitted when a new popup notification appears. Only emitted if
dnd
is set toFalse
.- Parameters:
notification (
Notification
) -- The instance of the notification.
- property notifications: list[Notification]#
read-only
A list of all notifications.
- property popups: list[Notification]#
read-only
A list of currently active popup notifications.
- property dnd: bool#
read-write
Do Not Disturb mode. If set to
True
, thenew_popup
signal will not be emitted, and all newNotification
instances will havepopup
set toFalse
.Default:
False
.
- property popup_timeout: int#
read-write
The timeout before a popup is automatically dismissed, in milliseconds.
Default:
5000
.
- property max_popups_count: int#
read-write
The Maximum number of popups. If the length of the
popups
list exceedsmax_popups_count
, the oldest popup will be dismissed.Default:
3
.
- get_notification(id: int) Notification | None #
Get
Notification
by ID.- Parameters:
id (
int
) -- The ID of the notification to get.- Return type:
- Returns:
Notification
orNone
- class ignis.services.notifications.Notification(dbus: DBusService, id: int, app_name: str, icon: str, summary: str, body: str, actions: list[str], urgency: int, timeout: int, time: float, popup: bool)#
A notification object. Contains data about the notification and allows performing actions.
- closed()#
Signal
Emitted when notification has been closed.
- dismissed()#
Signal
Emitted when notification has been dismissed.
- property body: str#
read-only
The body text of the notification, usually containing additional information.
- property actions: list[NotificationAction]#
read-only
A list of actions associated with the notification.
- property timeout: int#
read-only
The timeout for the notification. Usually equal to the
popup_timeout
property of theNotificationService
unless the notification specifies otherwise.
- property urgency: int#
read-only
The urgency of the notification.
- Levels:
-1: Not provided
0: Low
1: Normal
2: Critical
- class ignis.services.notifications.NotificationAction(dbus: DBusService, notification, id: str, label: str)#
A simple object that contains data about a notification action.