Notifications#

class ignis.services.notifications.NotificationService(*args: Any, **kwargs: Any)#

A notification daemon. Allow receiving notifications and perform actions on them.

There are options available for this service: Notifications.

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))
signal notified#

Emitted when a new notification appears.

Parameters:

notification (Notification) -- The instance of the notification.

signal new_popup#

Emitted when a new popup notification appears. Only emitted if dnd is set to False.

Parameters:

notification (Notification) -- The instance of the notification.

gproperty notifications: list[Notification]#
  • read-only

A list of all notifications.

gproperty popups: list[Notification]#
  • read-only

A list of currently active popup notifications.

get_notification(id: int) Notification | None#

Get Notification by ID.

Parameters:

id (int) -- The ID of the notification to get.

Return type:

Notification | None

Returns:

Notification or None

clear_all() None#

Clear all notifications.

Return type:

None

class ignis.services.notifications.Notification(dbus: DBusService, id: int, app_name: str, icon: str | None, 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.

signal closed#

Emitted when notification has been closed.

signal dismissed#

Emitted when notification has been dismissed.

gproperty id: int#
  • read-only

The ID of the notification.

gproperty app_name: str#
  • read-only

The name of the application that sent the notification.

gproperty icon: str | None#
  • read-only

The icon name, path to image or None.

gproperty summary: str#
  • read-only

The summary text of the notification, usually the title.

gproperty body: str#
  • read-only

The body text of the notification, usually containing additional information.

gproperty actions: list[NotificationAction]#
  • read-only

A list of actions associated with the notification.

gproperty timeout: int#
  • read-only

The timeout for the notification. Usually equal to the popup_timeout property of the NotificationService unless the notification specifies otherwise.

gproperty time: float#
  • read-only

Time in POSIX format when the notification was sent.

gproperty urgency: int#
  • read-only

The urgency of the notification.

Levels:
  • -1: Not provided

  • 0: Low

  • 1: Normal

  • 2: Critical

gproperty popup: bool#
  • read-only

Whether the notification is a popup.

gproperty json: dict#
  • read-only

The notification data in dictionary format.

close() None#

Close the notification. This will remove it from notifications history.

Return type:

None

dismiss() None#

Dismiss the notification.

Return type:

None

class ignis.services.notifications.NotificationAction(dbus: DBusService, notification, id: str, label: str)#

A simple object that contains data about a notification action.

gproperty id: str#
  • read-only

The ID of the action.

gproperty label: str#
  • read-only

The label of the notification. This one should be displayed to user.

invoke() None#

Invoke this action.

Return type:

None