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.level_number_to_name(number)[source]
Converts a Maestral notification level number to name.
- maestral.notify.level_name_to_number(name)[source]
Converts a Maestral notification level name to number.
- 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(self)[source]
Custom notification level. Notifications with a lower level will be discarded.
- Return type
- property snoozed(self)[source]
Time in minutes to snooze notifications. Applied to FILECHANGE level only.
- Return type
- notify(self, 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