This module defines base classes for desktop notifications. All platform implementations must inherit from DesktopNotifierBase.

Module Contents



Enumeration of notification levels


A desktop notification


Base class for desktop notifier implementations

class maestral.notify.notify_base.NotificationLevel[source]

Bases: enum.Enum

Enumeration of notification levels

The interpretation and visuals will depend on the platform.

  • Critical – For critical errors.

  • Normal – Default platform notification level.

  • Low – Low priority notification.

Critical = critical[source]
Normal = normal[source]
Low = low[source]
class maestral.notify.notify_base.Notification(title: str, message: str, urgency: NotificationLevel = NotificationLevel.Normal, icon: Optional[str] = None, action: Optional[Callable] = None, buttons: Optional[Dict[str, Optional[Callable]]] = None)[source]

A desktop notification

  • title – Notification title.

  • message – Notification message.

  • urgency – Notification level: low, normal or critical. This is ignored by some implementations.

  • icon – Path to an icon to use for the notification, typically the app icon. This is ignored by some implementations, e.g., on macOS where the icon of the app bundle is always used.

  • action – Handler to call when the notification is clicked. This is ignored by some implementations.

  • buttons – A dictionary with button names to show in the notification and handler to call when the respective button is clicked. This is ignored by some implementations.


identifier – An identifier which gets assigned to the notification after it is sent. This may be a str or int, depending on the type of identifier used by the platform.

identifier :Union[str, int, None][source]
class maestral.notify.notify_base.DesktopNotifierBase(app_name: str = '', app_id: str = '', notification_limit: int = 5)[source]

Base class for desktop notifier implementations

Notification levels CRITICAL, NORMAL and LOW may be used by some implementations to determine how a notification is displayed.

  • app_name – Name to identify the application in the notification center. On Linux, this should correspond to the application name in a desktop entry. On macOS, this field is discarded and the app is identified by the bundle id of the sending program (e.g., Python).

  • notification_limit – Maximum number of notifications to keep in the system’s notification center. This may be ignored by some implementations.

app_name :str[source]
notification_limit :int[source]
current_notifications :Dict[int, Notification][source]
abstract send(self, notification: Notification)None[source]

Sends a desktop notification. Some arguments may be ignored, depending on the implementation.


notification – Notification to send.