desktop_notifier.macos_legacy#

NSUserNotificationCenter backend for macOS.

  • Should be used for macOS 10.13 and earlier.

  • Deprecated but still available in macOS 11.0.

  • Requires a running CFRunLoop to invoke callbacks.

Module Contents#

Classes#

CocoaNotificationCenterLegacy

NSUserNotificationCenter backend for macOS

class desktop_notifier.macos_legacy.CocoaNotificationCenterLegacy(app_name='Python', notification_limit=None)[source]#

Bases: desktop_notifier.base.DesktopNotifierBase

NSUserNotificationCenter backend for macOS

Should be used for macOS High Sierra and earlier. Supports only a single button per notification. Both app name and bundle identifier will be ignored. The notification center automatically uses the values provided by the app bundle or the Python framework.

Parameters:
  • app_name (str) – The name of the app. Does not have any effect because the app name is automatically determined from the bundle or framework.

  • notification_limit (Optional[int]) – Maximum number of notifications to keep in the system’s notification center.

async request_authorisation()[source]#

Request authorisation to send notifications.

Returns:

Whether authorisation has been granted.

Return type:

bool

async has_authorisation()[source]#

Whether we have authorisation to send notifications.

Return type:

bool

async _send(notification, notification_to_replace)[source]#

Uses NSUserNotificationCenter to schedule a notification.

Parameters:
Return type:

str

async _clear(notification)[source]#

Removes a notifications from the notification center

Parameters:

notification (desktop_notifier.base.Notification) – Notification to clear.

Return type:

None

async _clear_all()[source]#

Clears all notifications from notification center

Return type:

None