maestral.notify

This module handles desktop notifications It uses the desktop-notifier package as a backend for cross-platform desktop notifications.

Module Contents

maestral.notify.NONE = 100[source]

No desktop notifications

maestral.notify.ERROR = 40[source]

Notify only on fatal errors

maestral.notify.SYNCISSUE = 30[source]

Notify for sync issues and higher

maestral.notify.FILECHANGE = 15[source]

Notify for all remote file changes

maestral.notify.level_number_to_name(number)[source]

Converts a Maestral notification level number to name.

Parameters

number (int) – Level number.

Returns

Level name.

Return type

str

maestral.notify.level_name_to_number(name)[source]

Converts a Maestral notification level name to number.

Parameters

name (str) – Level name.

Returns

Level number.

Return type

int

class maestral.notify.MaestralDesktopNotifier(config_name)[source]

Desktop notification emitter for Maestral

Desktop notifier with snooze functionality and variable notification levels. Must be instantiated in the main thread.

Parameters

config_name (str) – Config name. This is used to access notification settings for the daemon.

property notify_level[source]

Custom notification level. Notifications with a lower level will be discarded.

Return type

int

property snoozed[source]

Time in minutes to snooze notifications. Applied to FILECHANGE level only.

Return type

float

notify(title, message, level=FILECHANGE, on_click=None, actions=None)[source]

Sends a desktop notification. This will schedule a notification task in the asyncio loop of the thread where DesktopNotifier was instantiated.

Parameters
  • title (str) – Notification title.

  • message (str) – Notification message.

  • level (int) – Notification level of the message.

  • on_click (Callable | None) – A callback to execute when the notification is clicked. The provided callable must not take any arguments.

  • actions (dict[str, Callable] | None) – A dictionary with button names and callbacks for the notification.

Return type

None