12
12
Attachment ,
13
13
Button ,
14
14
Capability ,
15
+ DispatchedNotification ,
15
16
Icon ,
16
17
Notification ,
17
18
ReplyField ,
@@ -41,7 +42,7 @@ def __init__(
41
42
app_icon : Icon | None = DEFAULT_ICON ,
42
43
notification_limit : int | None = None ,
43
44
) -> None :
44
- self ._async_api = DesktopNotifier (app_name , app_icon )
45
+ self ._async_api = DesktopNotifier (app_name , app_icon , notification_limit )
45
46
self ._loop = asyncio .new_event_loop ()
46
47
47
48
def _run_coro_sync (self , coro : Coroutine [None , None , T ]) -> T :
@@ -62,9 +63,17 @@ def app_name(self) -> str:
62
63
63
64
@app_name .setter
64
65
def app_name (self , value : str ) -> None :
65
- """Setter: app_name"""
66
66
self ._async_api .app_name = value
67
67
68
+ @property
69
+ def app_icon (self ) -> Icon | None :
70
+ """The application icon"""
71
+ return self ._async_api .app_icon
72
+
73
+ @app_icon .setter
74
+ def app_icon (self , value : Icon | None ) -> None :
75
+ self ._async_api .app_icon = value
76
+
68
77
def request_authorisation (self ) -> bool :
69
78
"""See :meth:`desktop_notifier.main.DesktopNotifier.request_authorisation`"""
70
79
coro = self ._async_api .request_authorisation ()
@@ -75,7 +84,9 @@ def has_authorisation(self) -> bool:
75
84
coro = self ._async_api .has_authorisation ()
76
85
return self ._run_coro_sync (coro )
77
86
78
- def send_notification (self , notification : Notification ) -> str :
87
+ def send_notification (
88
+ self , notification : Notification | DispatchedNotification
89
+ ) -> DispatchedNotification | None :
79
90
"""See :meth:`desktop_notifier.main.DesktopNotifier.send_notification`"""
80
91
coro = self ._async_api .send_notification (notification )
81
92
return self ._run_coro_sync (coro )
@@ -88,13 +99,14 @@ def send(
88
99
icon : Icon | None = None ,
89
100
buttons : Sequence [Button ] = (),
90
101
reply_field : ReplyField | None = None ,
102
+ on_cleared : Callable [[], Any ] | None = None ,
91
103
on_clicked : Callable [[], Any ] | None = None ,
92
104
on_dismissed : Callable [[], Any ] | None = None ,
93
105
attachment : Attachment | None = None ,
94
106
sound : Sound | None = None ,
95
107
thread : str | None = None ,
96
108
timeout : int = - 1 , # in seconds
97
- ) -> str :
109
+ ) -> DispatchedNotification | None :
98
110
"""See :meth:`desktop_notifier.main.DesktopNotifier.send`"""
99
111
notification = Notification (
100
112
title ,
@@ -103,6 +115,7 @@ def send(
103
115
icon = icon ,
104
116
buttons = tuple (buttons ),
105
117
reply_field = reply_field ,
118
+ on_cleared = on_cleared ,
106
119
on_clicked = on_clicked ,
107
120
on_dismissed = on_dismissed ,
108
121
attachment = attachment ,
@@ -113,7 +126,7 @@ def send(
113
126
coro = self ._async_api .send_notification (notification )
114
127
return self ._run_coro_sync (coro )
115
128
116
- def get_current_notifications (self ) -> list [str ]:
129
+ def get_current_notifications (self ) -> dict [str , DispatchedNotification ]:
117
130
"""See :meth:`desktop_notifier.main.DesktopNotifier.get_current_notifications`"""
118
131
coro = self ._async_api .get_current_notifications ()
119
132
return self ._run_coro_sync (coro )
0 commit comments