The client
When you are looking to integrate macos-notifications with your project, the client
is the first place to look.
If you have a service that periodically restarts, you might want to take a look at the CacheClient
.
client
create_notification(title='Notification', subtitle=None, text=None, icon=None, sound=None, delay=timedelta(), action_button_str=None, action_callback=None, reply_button_str=None, reply_callback=None, snooze_button_str=None)
Create a MacOS notification :)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
title |
str
|
Title of the notification. |
'Notification'
|
subtitle |
str | None
|
The subtitle of the notification. |
None
|
text |
str | None
|
The text/main body of the notification. |
None
|
icon |
str | Path | None
|
An Icon you would like to set on the right bottom. |
None
|
delay |
timedelta
|
Delay before showing the message. |
timedelta()
|
action_button_str |
str | None
|
The string of the Action button. |
None
|
action_callback |
Callable[[], None] | None
|
The function to call when the action button is pressed. |
None
|
reply_button_str |
str | None
|
The string of the Reply button. |
None
|
reply_callback |
Callable[[str], None] | None
|
The function to call with the replied text. |
None
|
snooze_button_str |
str | None
|
This is a useless button that closes the notification (but not the process). Think of this as a snooze button. |
None
|
Source code in mac_notifications/client.py
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 |
|
get_notification_manager()
Return the NotificationManager object.
Source code in mac_notifications/client.py
19 20 21 |
|
More advanced usages
To get a bit more information about the amount of notifications that are still active, you can use the following function:
get_notification_manager()
Return the NotificationManager object.
Source code in mac_notifications/client.py
19 20 21 |
|