desktop-notifier 6.1.1.dev0__tar.gz → 6.3.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {desktop_notifier-6.1.1.dev0/src/desktop_notifier.egg-info → desktop_notifier-6.3.0}/PKG-INFO +22 -22
- {desktop_notifier-6.1.1.dev0 → desktop_notifier-6.3.0}/README.md +4 -4
- {desktop_notifier-6.1.1.dev0 → desktop_notifier-6.3.0}/pyproject.toml +18 -19
- {desktop_notifier-6.1.1.dev0 → desktop_notifier-6.3.0}/src/desktop_notifier/__init__.py +2 -1
- {desktop_notifier-6.1.1.dev0 → desktop_notifier-6.3.0}/src/desktop_notifier/backends/base.py +24 -34
- {desktop_notifier-6.1.1.dev0 → desktop_notifier-6.3.0}/src/desktop_notifier/backends/dbus.py +38 -18
- {desktop_notifier-6.1.1.dev0 → desktop_notifier-6.3.0}/src/desktop_notifier/backends/dummy.py +1 -0
- {desktop_notifier-6.1.1.dev0 → desktop_notifier-6.3.0}/src/desktop_notifier/backends/macos.py +21 -25
- {desktop_notifier-6.1.1.dev0 → desktop_notifier-6.3.0}/src/desktop_notifier/backends/winrt.py +17 -21
- {desktop_notifier-6.1.1.dev0 → desktop_notifier-6.3.0}/src/desktop_notifier/common.py +28 -19
- {desktop_notifier-6.1.1.dev0 → desktop_notifier-6.3.0}/src/desktop_notifier/main.py +13 -4
- {desktop_notifier-6.1.1.dev0 → desktop_notifier-6.3.0}/src/desktop_notifier/sync.py +46 -0
- {desktop_notifier-6.1.1.dev0 → desktop_notifier-6.3.0/src/desktop_notifier.egg-info}/PKG-INFO +22 -22
- desktop_notifier-6.3.0/src/desktop_notifier.egg-info/requires.txt +34 -0
- desktop_notifier-6.1.1.dev0/src/desktop_notifier.egg-info/requires.txt +0 -34
- {desktop_notifier-6.1.1.dev0 → desktop_notifier-6.3.0}/LICENSE +0 -0
- {desktop_notifier-6.1.1.dev0 → desktop_notifier-6.3.0}/setup.cfg +0 -0
- {desktop_notifier-6.1.1.dev0 → desktop_notifier-6.3.0}/src/desktop_notifier/backends/__init__.py +0 -0
- {desktop_notifier-6.1.1.dev0 → desktop_notifier-6.3.0}/src/desktop_notifier/backends/macos_support.py +0 -0
- {desktop_notifier-6.1.1.dev0 → desktop_notifier-6.3.0}/src/desktop_notifier/py.typed +0 -0
- {desktop_notifier-6.1.1.dev0 → desktop_notifier-6.3.0}/src/desktop_notifier/resources/__init__.py +0 -0
- {desktop_notifier-6.1.1.dev0 → desktop_notifier-6.3.0}/src/desktop_notifier/resources/python.png +0 -0
- {desktop_notifier-6.1.1.dev0 → desktop_notifier-6.3.0}/src/desktop_notifier.egg-info/SOURCES.txt +0 -0
- {desktop_notifier-6.1.1.dev0 → desktop_notifier-6.3.0}/src/desktop_notifier.egg-info/dependency_links.txt +0 -0
- {desktop_notifier-6.1.1.dev0 → desktop_notifier-6.3.0}/src/desktop_notifier.egg-info/top_level.txt +0 -0
- {desktop_notifier-6.1.1.dev0 → desktop_notifier-6.3.0}/tests/test_api.py +0 -0
- {desktop_notifier-6.1.1.dev0 → desktop_notifier-6.3.0}/tests/test_callbacks.py +0 -0
- {desktop_notifier-6.1.1.dev0 → desktop_notifier-6.3.0}/tests/test_sync_api.py +0 -0
{desktop_notifier-6.1.1.dev0/src/desktop_notifier.egg-info → desktop_notifier-6.3.0}/PKG-INFO
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: desktop-notifier
|
|
3
|
-
Version: 6.
|
|
3
|
+
Version: 6.3.0
|
|
4
4
|
Summary: Python library for cross-platform desktop notifications
|
|
5
5
|
Author-email: Sam Schott <sam.schott@outlook.com>
|
|
6
6
|
License-Expression: MIT
|
|
@@ -13,31 +13,31 @@ Classifier: Operating System :: MacOS :: MacOS X
|
|
|
13
13
|
Classifier: Operating System :: Microsoft :: Windows
|
|
14
14
|
Classifier: Operating System :: OS Independent
|
|
15
15
|
Classifier: Programming Language :: Python :: 3
|
|
16
|
-
Classifier: Programming Language :: Python :: 3.9
|
|
17
|
-
Classifier: Programming Language :: Python :: 3.10
|
|
18
16
|
Classifier: Programming Language :: Python :: 3.11
|
|
19
17
|
Classifier: Programming Language :: Python :: 3.12
|
|
20
18
|
Classifier: Programming Language :: Python :: 3.13
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.15
|
|
21
21
|
Classifier: Programming Language :: Python :: 3 :: Only
|
|
22
22
|
Classifier: Topic :: Communications
|
|
23
23
|
Classifier: Topic :: Desktop Environment
|
|
24
24
|
Classifier: Topic :: Desktop Environment :: Gnome
|
|
25
25
|
Classifier: Topic :: Desktop Environment :: K Desktop Environment (KDE)
|
|
26
26
|
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
27
|
-
Requires-Python: >=3.
|
|
27
|
+
Requires-Python: >=3.11
|
|
28
28
|
Description-Content-Type: text/markdown
|
|
29
29
|
License-File: LICENSE
|
|
30
|
-
Requires-Dist: bidict
|
|
30
|
+
Requires-Dist: bidict>=0.24.1
|
|
31
31
|
Requires-Dist: packaging
|
|
32
|
-
Requires-Dist:
|
|
33
|
-
Requires-Dist: dbus-fast; sys_platform == "linux"
|
|
34
|
-
Requires-Dist: rubicon-objc>=0.5; sys_platform == "darwin"
|
|
35
|
-
Requires-Dist: winrt-runtime>=
|
|
36
|
-
Requires-Dist: winrt-windows.applicationmodel.core>=
|
|
37
|
-
Requires-Dist: winrt-windows.data.xml.dom>=
|
|
38
|
-
Requires-Dist: winrt-windows.foundation>=
|
|
39
|
-
Requires-Dist: winrt-windows.foundation.collections>=
|
|
40
|
-
Requires-Dist: winrt-windows.ui.notifications>=
|
|
32
|
+
Requires-Dist: immutabledict
|
|
33
|
+
Requires-Dist: dbus-fast>=5.0; sys_platform == "linux"
|
|
34
|
+
Requires-Dist: rubicon-objc>=0.5.7; sys_platform == "darwin"
|
|
35
|
+
Requires-Dist: winrt-runtime>=4.0.1; sys_platform == "win32"
|
|
36
|
+
Requires-Dist: winrt-windows.applicationmodel.core>=4.0.1; sys_platform == "win32"
|
|
37
|
+
Requires-Dist: winrt-windows.data.xml.dom>=4.0.1; sys_platform == "win32"
|
|
38
|
+
Requires-Dist: winrt-windows.foundation>=4.0.1; sys_platform == "win32"
|
|
39
|
+
Requires-Dist: winrt-windows.foundation.collections>=4.0.1; sys_platform == "win32"
|
|
40
|
+
Requires-Dist: winrt-windows.ui.notifications>=4.0.1; sys_platform == "win32"
|
|
41
41
|
Provides-Extra: dev
|
|
42
42
|
Requires-Dist: black; extra == "dev"
|
|
43
43
|
Requires-Dist: bump2version; extra == "dev"
|
|
@@ -46,12 +46,12 @@ Requires-Dist: flake8-pyproject; extra == "dev"
|
|
|
46
46
|
Requires-Dist: isort; extra == "dev"
|
|
47
47
|
Requires-Dist: mypy; extra == "dev"
|
|
48
48
|
Requires-Dist: pytest; extra == "dev"
|
|
49
|
-
Requires-Dist: pytest-asyncio; extra == "dev"
|
|
49
|
+
Requires-Dist: pytest-asyncio>=1.4.1; extra == "dev"
|
|
50
50
|
Requires-Dist: pytest-cov; extra == "dev"
|
|
51
51
|
Provides-Extra: docs
|
|
52
|
-
Requires-Dist: furo==
|
|
53
|
-
Requires-Dist: sphinx==
|
|
54
|
-
Requires-Dist: sphinx-autoapi==3.
|
|
52
|
+
Requires-Dist: furo==2025.12.19; extra == "docs"
|
|
53
|
+
Requires-Dist: sphinx==9.2.0; extra == "docs"
|
|
54
|
+
Requires-Dist: sphinx-autoapi==3.9.0; extra == "docs"
|
|
55
55
|
Requires-Dist: sphinx-mdinclude==0.6.2; extra == "docs"
|
|
56
56
|
Dynamic: license-file
|
|
57
57
|
|
|
@@ -175,10 +175,10 @@ Foundation CFRunLoop with asyncio:
|
|
|
175
175
|
|
|
176
176
|
```Python
|
|
177
177
|
import asyncio
|
|
178
|
-
from rubicon.objc.eventloop import
|
|
178
|
+
from rubicon.objc.eventloop import RubiconEventLoop
|
|
179
179
|
|
|
180
|
-
|
|
181
|
-
|
|
180
|
+
with asyncio.Runner(loop_factory=RubiconEventLoop) as runner:
|
|
181
|
+
runner.run(main())
|
|
182
182
|
```
|
|
183
183
|
|
|
184
184
|
Desktop-notifier itself uses Rubicon Objective-C to interface with Cocoa APIs. A full
|
|
@@ -226,6 +226,6 @@ This package is opinionated in a few ways:
|
|
|
226
226
|
|
|
227
227
|
## Dependencies
|
|
228
228
|
|
|
229
|
-
* [dbus-
|
|
229
|
+
* [dbus-fast](https://github.com/Bluetooth-Devices/dbus-fast) on Linux
|
|
230
230
|
* [rubicon-objc](https://github.com/beeware/rubicon-objc) on macOS
|
|
231
231
|
* [pywinrt](https://github.com/pywinrt/pywinrt) on Windows
|
|
@@ -118,10 +118,10 @@ Foundation CFRunLoop with asyncio:
|
|
|
118
118
|
|
|
119
119
|
```Python
|
|
120
120
|
import asyncio
|
|
121
|
-
from rubicon.objc.eventloop import
|
|
121
|
+
from rubicon.objc.eventloop import RubiconEventLoop
|
|
122
122
|
|
|
123
|
-
|
|
124
|
-
|
|
123
|
+
with asyncio.Runner(loop_factory=RubiconEventLoop) as runner:
|
|
124
|
+
runner.run(main())
|
|
125
125
|
```
|
|
126
126
|
|
|
127
127
|
Desktop-notifier itself uses Rubicon Objective-C to interface with Cocoa APIs. A full
|
|
@@ -169,6 +169,6 @@ This package is opinionated in a few ways:
|
|
|
169
169
|
|
|
170
170
|
## Dependencies
|
|
171
171
|
|
|
172
|
-
* [dbus-
|
|
172
|
+
* [dbus-fast](https://github.com/Bluetooth-Devices/dbus-fast) on Linux
|
|
173
173
|
* [rubicon-objc](https://github.com/beeware/rubicon-objc) on macOS
|
|
174
174
|
* [pywinrt](https://github.com/pywinrt/pywinrt) on Windows
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "desktop-notifier"
|
|
7
|
-
version = "6.
|
|
7
|
+
version = "6.3.0"
|
|
8
8
|
authors = [{name = "Sam Schott", email = "sam.schott@outlook.com"}]
|
|
9
9
|
license = "MIT"
|
|
10
10
|
description = "Python library for cross-platform desktop notifications"
|
|
@@ -23,11 +23,11 @@ classifiers = [
|
|
|
23
23
|
"Operating System :: Microsoft :: Windows",
|
|
24
24
|
"Operating System :: OS Independent",
|
|
25
25
|
"Programming Language :: Python :: 3",
|
|
26
|
-
"Programming Language :: Python :: 3.9",
|
|
27
|
-
"Programming Language :: Python :: 3.10",
|
|
28
26
|
"Programming Language :: Python :: 3.11",
|
|
29
27
|
"Programming Language :: Python :: 3.12",
|
|
30
28
|
"Programming Language :: Python :: 3.13",
|
|
29
|
+
"Programming Language :: Python :: 3.14",
|
|
30
|
+
"Programming Language :: Python :: 3.15",
|
|
31
31
|
"Programming Language :: Python :: 3 :: Only",
|
|
32
32
|
"Topic :: Communications",
|
|
33
33
|
"Topic :: Desktop Environment",
|
|
@@ -35,19 +35,19 @@ classifiers = [
|
|
|
35
35
|
"Topic :: Desktop Environment :: K Desktop Environment (KDE)",
|
|
36
36
|
"Topic :: Software Development :: Libraries :: Python Modules",
|
|
37
37
|
]
|
|
38
|
-
requires-python = ">=3.
|
|
38
|
+
requires-python = ">=3.11"
|
|
39
39
|
dependencies = [
|
|
40
|
-
"bidict",
|
|
40
|
+
"bidict>=0.24.1",
|
|
41
41
|
"packaging",
|
|
42
|
-
"
|
|
43
|
-
"dbus-fast;sys_platform=='linux'",
|
|
44
|
-
"rubicon-objc>=0.5;sys_platform=='darwin'",
|
|
45
|
-
"winrt-runtime>=
|
|
46
|
-
"winrt-windows.applicationmodel.core>=
|
|
47
|
-
"winrt-windows.data.xml.dom>=
|
|
48
|
-
"winrt-windows.foundation>=
|
|
49
|
-
"winrt-windows.foundation.collections>=
|
|
50
|
-
"winrt-windows.ui.notifications>=
|
|
42
|
+
"immutabledict",
|
|
43
|
+
"dbus-fast>=5.0;sys_platform=='linux'",
|
|
44
|
+
"rubicon-objc>=0.5.7;sys_platform=='darwin'",
|
|
45
|
+
"winrt-runtime>=4.0.1;sys_platform=='win32'",
|
|
46
|
+
"winrt-windows.applicationmodel.core>=4.0.1;sys_platform=='win32'",
|
|
47
|
+
"winrt-windows.data.xml.dom>=4.0.1;sys_platform=='win32'",
|
|
48
|
+
"winrt-windows.foundation>=4.0.1;sys_platform=='win32'",
|
|
49
|
+
"winrt-windows.foundation.collections>=4.0.1;sys_platform=='win32'",
|
|
50
|
+
"winrt-windows.ui.notifications>=4.0.1;sys_platform=='win32'",
|
|
51
51
|
]
|
|
52
52
|
|
|
53
53
|
[project.readme]
|
|
@@ -66,13 +66,13 @@ dev = [
|
|
|
66
66
|
"isort",
|
|
67
67
|
"mypy",
|
|
68
68
|
"pytest",
|
|
69
|
-
"pytest-asyncio",
|
|
69
|
+
"pytest-asyncio>=1.4.1",
|
|
70
70
|
"pytest-cov",
|
|
71
71
|
]
|
|
72
72
|
docs = [
|
|
73
|
-
"furo==
|
|
74
|
-
"sphinx==
|
|
75
|
-
"sphinx-autoapi==3.
|
|
73
|
+
"furo==2025.12.19",
|
|
74
|
+
"sphinx==9.2.0",
|
|
75
|
+
"sphinx-autoapi==3.9.0",
|
|
76
76
|
"sphinx-mdinclude==0.6.2",
|
|
77
77
|
]
|
|
78
78
|
|
|
@@ -95,7 +95,6 @@ files = ["src"]
|
|
|
95
95
|
|
|
96
96
|
[tool.black]
|
|
97
97
|
line-length = 88
|
|
98
|
-
target-version = ["py38", "py39", "py310", "py311", "py312", "py313"]
|
|
99
98
|
|
|
100
99
|
[tool.isort]
|
|
101
100
|
profile = "black"
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
"""
|
|
3
3
|
Desktop notifications for Windows, Linux, macOS, iOS and iPadOS.
|
|
4
4
|
"""
|
|
5
|
+
|
|
5
6
|
from .main import (
|
|
6
7
|
DEFAULT_ICON,
|
|
7
8
|
DEFAULT_SOUND,
|
|
@@ -17,7 +18,7 @@ from .main import (
|
|
|
17
18
|
)
|
|
18
19
|
from .sync import DesktopNotifierSync
|
|
19
20
|
|
|
20
|
-
__version__ = "6.
|
|
21
|
+
__version__ = "6.3.0"
|
|
21
22
|
__author__ = "Sam Schott"
|
|
22
23
|
__url__ = "https://github.com/samschott/desktop-notifier"
|
|
23
24
|
|
{desktop_notifier-6.1.1.dev0 → desktop_notifier-6.3.0}/src/desktop_notifier/backends/base.py
RENAMED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
"""
|
|
3
3
|
This module defines the abstract implementation class that backends must inherit from.
|
|
4
4
|
"""
|
|
5
|
+
|
|
5
6
|
from __future__ import annotations
|
|
6
7
|
|
|
7
8
|
import logging
|
|
@@ -71,7 +72,7 @@ class DesktopNotifierBackend(ABC):
|
|
|
71
72
|
logger.debug("Notification sent: %s", notification)
|
|
72
73
|
self._notification_cache[notification.identifier] = notification
|
|
73
74
|
|
|
74
|
-
self.handle_dispatched(notification.identifier
|
|
75
|
+
self.handle_dispatched(notification.identifier)
|
|
75
76
|
|
|
76
77
|
def _clear_notification_from_cache(self, identifier: str) -> Notification | None:
|
|
77
78
|
"""
|
|
@@ -153,54 +154,43 @@ class DesktopNotifierBackend(ABC):
|
|
|
153
154
|
self._capabilities = await self._get_capabilities()
|
|
154
155
|
return self._capabilities
|
|
155
156
|
|
|
156
|
-
def handle_dispatched(
|
|
157
|
-
|
|
158
|
-
) -> None:
|
|
157
|
+
def handle_dispatched(self, identifier: str) -> None:
|
|
158
|
+
notification = self._notification_cache.get(identifier)
|
|
159
159
|
if notification and notification.on_dispatched:
|
|
160
160
|
notification.on_dispatched()
|
|
161
161
|
elif self.on_dispatched:
|
|
162
162
|
self.on_dispatched(identifier)
|
|
163
163
|
|
|
164
|
-
def handle_clicked(
|
|
165
|
-
|
|
166
|
-
) -> None:
|
|
164
|
+
def handle_clicked(self, identifier: str) -> None:
|
|
165
|
+
notification = self._clear_notification_from_cache(identifier)
|
|
167
166
|
if notification and notification.on_clicked:
|
|
168
167
|
notification.on_clicked()
|
|
169
168
|
elif self.on_clicked:
|
|
170
169
|
self.on_clicked(identifier)
|
|
171
170
|
|
|
172
|
-
def handle_dismissed(
|
|
173
|
-
|
|
174
|
-
) -> None:
|
|
171
|
+
def handle_dismissed(self, identifier: str) -> None:
|
|
172
|
+
notification = self._clear_notification_from_cache(identifier)
|
|
175
173
|
if notification and notification.on_dismissed:
|
|
176
174
|
notification.on_dismissed()
|
|
177
175
|
elif self.on_dismissed:
|
|
178
176
|
self.on_dismissed(identifier)
|
|
179
177
|
|
|
180
|
-
def handle_replied(
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
notification.reply_field.on_replied(reply_text)
|
|
189
|
-
elif self.on_replied:
|
|
178
|
+
def handle_replied(self, identifier: str, reply_text: str) -> None:
|
|
179
|
+
notification = self._clear_notification_from_cache(identifier)
|
|
180
|
+
if notification:
|
|
181
|
+
reply_field = notification.reply_field
|
|
182
|
+
if reply_field and reply_field.on_replied:
|
|
183
|
+
reply_field.on_replied(reply_text)
|
|
184
|
+
return
|
|
185
|
+
if self.on_replied:
|
|
190
186
|
self.on_replied(identifier, reply_text)
|
|
191
187
|
|
|
192
|
-
def handle_button(
|
|
193
|
-
self
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
else:
|
|
201
|
-
button = None
|
|
202
|
-
|
|
203
|
-
if button and button.on_pressed:
|
|
204
|
-
button.on_pressed()
|
|
205
|
-
elif self.on_button_pressed:
|
|
188
|
+
def handle_button(self, identifier: str, button_identifier: str) -> None:
|
|
189
|
+
notification = self._clear_notification_from_cache(identifier)
|
|
190
|
+
if notification and button_identifier in notification.buttons_dict:
|
|
191
|
+
button = notification.buttons_dict[button_identifier]
|
|
192
|
+
if button and button.on_pressed:
|
|
193
|
+
button.on_pressed()
|
|
194
|
+
return
|
|
195
|
+
if self.on_button_pressed:
|
|
206
196
|
self.on_button_pressed(identifier, button_identifier)
|
{desktop_notifier-6.1.1.dev0 → desktop_notifier-6.3.0}/src/desktop_notifier/backends/dbus.py
RENAMED
|
@@ -5,6 +5,7 @@ Notification backend for Linux
|
|
|
5
5
|
Includes an implementation to send desktop notifications over Dbus. Responding to user
|
|
6
6
|
interaction with a notification requires a running asyncio event loop.
|
|
7
7
|
"""
|
|
8
|
+
|
|
8
9
|
from __future__ import annotations
|
|
9
10
|
|
|
10
11
|
import logging
|
|
@@ -31,6 +32,8 @@ NOTIFICATION_CLOSED_PROGRAMMATICALLY = 3
|
|
|
31
32
|
NOTIFICATION_CLOSED_UNDEFINED = 4
|
|
32
33
|
|
|
33
34
|
DEFAULT_ACTION_KEY = "default"
|
|
35
|
+
INLINE_REPLY_ACTION_KEY = "inline-reply"
|
|
36
|
+
INLINE_REPLY_BUTTON_TEXT_KEY = "x-kde-reply-submit-button-text"
|
|
34
37
|
|
|
35
38
|
|
|
36
39
|
class DBusDesktopNotifier(DesktopNotifierBackend):
|
|
@@ -90,6 +93,9 @@ class DBusDesktopNotifier(DesktopNotifierBackend):
|
|
|
90
93
|
if hasattr(self.interface, "on_action_invoked"):
|
|
91
94
|
self.interface.on_action_invoked(self._on_action)
|
|
92
95
|
|
|
96
|
+
if hasattr(self.interface, "on_notification_replied"):
|
|
97
|
+
self.interface.on_notification_replied(self._on_reply)
|
|
98
|
+
|
|
93
99
|
return self.interface
|
|
94
100
|
|
|
95
101
|
async def _send(self, notification: Notification) -> None:
|
|
@@ -102,6 +108,7 @@ class DBusDesktopNotifier(DesktopNotifierBackend):
|
|
|
102
108
|
self.interface = await self._init_dbus()
|
|
103
109
|
|
|
104
110
|
actions = []
|
|
111
|
+
hints_v: dict[str, Variant] = dict()
|
|
105
112
|
|
|
106
113
|
# The "default" action is invoked when clicking on the notification body.
|
|
107
114
|
if Capability.ON_CLICKED in await self.get_capabilities():
|
|
@@ -110,7 +117,15 @@ class DBusDesktopNotifier(DesktopNotifierBackend):
|
|
|
110
117
|
for button in notification.buttons:
|
|
111
118
|
actions += [button.identifier, button.title]
|
|
112
119
|
|
|
113
|
-
|
|
120
|
+
if (
|
|
121
|
+
notification.reply_field
|
|
122
|
+
and Capability.REPLY_FIELD in await self.get_capabilities()
|
|
123
|
+
):
|
|
124
|
+
actions += [INLINE_REPLY_ACTION_KEY, notification.reply_field.title]
|
|
125
|
+
hints_v[INLINE_REPLY_BUTTON_TEXT_KEY] = Variant(
|
|
126
|
+
"s", notification.reply_field.button_title
|
|
127
|
+
)
|
|
128
|
+
|
|
114
129
|
hints_v["urgency"] = self.to_native_urgency[notification.urgency]
|
|
115
130
|
|
|
116
131
|
if notification.sound:
|
|
@@ -158,9 +173,9 @@ class DBusDesktopNotifier(DesktopNotifierBackend):
|
|
|
158
173
|
else self.app_icon.as_uri()
|
|
159
174
|
)
|
|
160
175
|
|
|
161
|
-
#
|
|
176
|
+
# dbus_fast proxy APIs are generated at runtime. Silence the type checker but
|
|
162
177
|
# raise an AttributeError if required.
|
|
163
|
-
platform_id = await self.interface.call_notify( # type:ignore[attr-defined]
|
|
178
|
+
platform_id = await self.interface.call_notify( # type: ignore[attr-defined]
|
|
164
179
|
self.app_name,
|
|
165
180
|
0,
|
|
166
181
|
icon,
|
|
@@ -186,9 +201,9 @@ class DBusDesktopNotifier(DesktopNotifierBackend):
|
|
|
186
201
|
]
|
|
187
202
|
|
|
188
203
|
try:
|
|
189
|
-
#
|
|
204
|
+
# dbus_fast proxy APIs are generated at runtime. Silence the type checker
|
|
190
205
|
# but raise an AttributeError if required.
|
|
191
|
-
await self.interface.call_close_notification( # type:ignore[attr-defined]
|
|
206
|
+
await self.interface.call_close_notification( # type: ignore[attr-defined]
|
|
192
207
|
platform_id
|
|
193
208
|
)
|
|
194
209
|
except DBusError:
|
|
@@ -226,16 +241,23 @@ class DBusDesktopNotifier(DesktopNotifierBackend):
|
|
|
226
241
|
ourselves when scheduling the notification.
|
|
227
242
|
"""
|
|
228
243
|
identifier = self._platform_to_interface_notification_identifier.pop(nid, "")
|
|
229
|
-
notification = self._clear_notification_from_cache(identifier)
|
|
230
|
-
|
|
231
|
-
if not notification:
|
|
232
|
-
return
|
|
233
244
|
|
|
234
245
|
if action_key == DEFAULT_ACTION_KEY:
|
|
235
|
-
self.handle_clicked(identifier
|
|
246
|
+
self.handle_clicked(identifier)
|
|
236
247
|
return
|
|
237
248
|
|
|
238
|
-
self.handle_button(identifier, action_key
|
|
249
|
+
self.handle_button(identifier, action_key)
|
|
250
|
+
|
|
251
|
+
def _on_reply(self, nid: int, reply_text: str) -> None:
|
|
252
|
+
"""
|
|
253
|
+
Called when the user replies to the notification. This will invoke the
|
|
254
|
+
handler callback.
|
|
255
|
+
|
|
256
|
+
:param nid: The platform's notification ID as an integer.
|
|
257
|
+
:param reply_text: The text of the user's reply.
|
|
258
|
+
"""
|
|
259
|
+
identifier = self._platform_to_interface_notification_identifier.pop(nid, "")
|
|
260
|
+
self.handle_replied(identifier, reply_text)
|
|
239
261
|
|
|
240
262
|
def _on_closed(self, nid: int, reason: int) -> None:
|
|
241
263
|
"""
|
|
@@ -246,13 +268,9 @@ class DBusDesktopNotifier(DesktopNotifierBackend):
|
|
|
246
268
|
:param reason: An integer describing the reason why the notification was closed.
|
|
247
269
|
"""
|
|
248
270
|
identifier = self._platform_to_interface_notification_identifier.pop(nid, "")
|
|
249
|
-
notification = self._clear_notification_from_cache(identifier)
|
|
250
|
-
|
|
251
|
-
if not notification:
|
|
252
|
-
return
|
|
253
271
|
|
|
254
272
|
if reason == NOTIFICATION_CLOSED_DISMISSED:
|
|
255
|
-
self.handle_dismissed(identifier
|
|
273
|
+
self.handle_dismissed(identifier)
|
|
256
274
|
|
|
257
275
|
async def _get_capabilities(self) -> frozenset[Capability]:
|
|
258
276
|
if not self.interface:
|
|
@@ -273,7 +291,7 @@ class DBusDesktopNotifier(DesktopNotifierBackend):
|
|
|
273
291
|
capabilities.add(Capability.ON_DISMISSED)
|
|
274
292
|
|
|
275
293
|
server_info = (
|
|
276
|
-
await self.interface.call_get_server_information() # type:ignore[attr-defined]
|
|
294
|
+
await self.interface.call_get_server_information() # type: ignore[attr-defined]
|
|
277
295
|
)
|
|
278
296
|
|
|
279
297
|
# xfce4-notifyd does not support a "default" action when the notification is
|
|
@@ -281,7 +299,7 @@ class DBusDesktopNotifier(DesktopNotifierBackend):
|
|
|
281
299
|
if server_info[0] != "Xfce Notify Daemon":
|
|
282
300
|
capabilities.add(Capability.ON_CLICKED)
|
|
283
301
|
|
|
284
|
-
cps = await self.interface.call_get_capabilities() # type:ignore[attr-defined]
|
|
302
|
+
cps = await self.interface.call_get_capabilities() # type: ignore[attr-defined]
|
|
285
303
|
|
|
286
304
|
if "actions" in cps:
|
|
287
305
|
capabilities.add(Capability.BUTTONS)
|
|
@@ -290,6 +308,8 @@ class DBusDesktopNotifier(DesktopNotifierBackend):
|
|
|
290
308
|
if "sound" in cps:
|
|
291
309
|
capabilities.add(Capability.SOUND)
|
|
292
310
|
capabilities.add(Capability.SOUND_NAME)
|
|
311
|
+
if "inline-reply" in cps:
|
|
312
|
+
capabilities.add(Capability.REPLY_FIELD)
|
|
293
313
|
|
|
294
314
|
hints_signature = get_hints_signature(self.interface)
|
|
295
315
|
if hints_signature not in self.supported_hint_signatures:
|
{desktop_notifier-6.1.1.dev0 → desktop_notifier-6.3.0}/src/desktop_notifier/backends/macos.py
RENAMED
|
@@ -8,6 +8,7 @@ UNUserNotificationCenter backend for macOS
|
|
|
8
8
|
signed Python framework (for example from python.org).
|
|
9
9
|
* Requires a running CFRunLoop to invoke callbacks.
|
|
10
10
|
"""
|
|
11
|
+
|
|
11
12
|
from __future__ import annotations
|
|
12
13
|
|
|
13
14
|
import asyncio
|
|
@@ -84,31 +85,27 @@ class UNNotificationInterruptionLevel(enum.Enum):
|
|
|
84
85
|
ReplyActionIdentifier = "com.desktop-notifier.ReplyActionIdentifier"
|
|
85
86
|
|
|
86
87
|
|
|
87
|
-
class NotificationCenterDelegate(NSObject): # type:ignore[misc]
|
|
88
|
+
class NotificationCenterDelegate(NSObject): # type: ignore[misc]
|
|
88
89
|
"""Delegate to handle user interactions with notifications"""
|
|
89
90
|
|
|
90
91
|
implementation: CocoaNotificationCenter
|
|
91
92
|
|
|
92
|
-
@objc_method # type:ignore[
|
|
93
|
+
@objc_method # type: ignore[untyped-decorator]
|
|
93
94
|
def userNotificationCenter_didReceiveNotificationResponse_withCompletionHandler_(
|
|
94
95
|
self, center: objc_id, response: objc_id, completion_handler: objc_block
|
|
95
96
|
) -> None:
|
|
96
97
|
identifier = py_from_ns(response.notification.request.identifier)
|
|
97
|
-
notification = self.implementation._clear_notification_from_cache(identifier)
|
|
98
98
|
|
|
99
99
|
if response.actionIdentifier == UNNotificationDefaultActionIdentifier:
|
|
100
|
-
self.implementation.handle_clicked(identifier
|
|
101
|
-
|
|
100
|
+
self.implementation.handle_clicked(identifier)
|
|
102
101
|
elif response.actionIdentifier == UNNotificationDismissActionIdentifier:
|
|
103
|
-
self.implementation.handle_dismissed(identifier
|
|
104
|
-
|
|
102
|
+
self.implementation.handle_dismissed(identifier)
|
|
105
103
|
elif response.actionIdentifier == ReplyActionIdentifier:
|
|
106
104
|
reply_text = py_from_ns(response.userText)
|
|
107
|
-
self.implementation.handle_replied(identifier, reply_text
|
|
108
|
-
|
|
105
|
+
self.implementation.handle_replied(identifier, reply_text)
|
|
109
106
|
else:
|
|
110
107
|
action_id = py_from_ns(response.actionIdentifier)
|
|
111
|
-
self.implementation.handle_button(identifier, action_id
|
|
108
|
+
self.implementation.handle_button(identifier, action_id)
|
|
112
109
|
|
|
113
110
|
completion_handler()
|
|
114
111
|
|
|
@@ -174,24 +171,23 @@ class CocoaNotificationCenter(DesktopNotifierBackend):
|
|
|
174
171
|
|
|
175
172
|
async def has_authorisation(self) -> bool:
|
|
176
173
|
"""Whether we have authorisation to send notifications."""
|
|
177
|
-
future: Future[UNNotificationSettings] = Future() # type:ignore[valid-type]
|
|
174
|
+
future: Future[UNNotificationSettings] = Future() # type: ignore[valid-type]
|
|
178
175
|
|
|
179
176
|
def handler(settings: objc_id) -> None:
|
|
180
177
|
settings = py_from_ns(settings)
|
|
181
178
|
future.set_result(settings)
|
|
182
|
-
future.set_result(settings)
|
|
183
179
|
|
|
184
180
|
self.nc.getNotificationSettingsWithCompletionHandler(handler)
|
|
185
181
|
|
|
186
182
|
settings = await asyncio.wrap_future(future)
|
|
187
|
-
return settings.authorizationStatus in ( # type:ignore[attr-defined]
|
|
183
|
+
return settings.authorizationStatus in ( # type: ignore[attr-defined]
|
|
188
184
|
UNAuthorizationStatusAuthorized,
|
|
189
185
|
UNAuthorizationStatusProvisional,
|
|
190
186
|
UNAuthorizationStatusEphemeral,
|
|
191
187
|
)
|
|
192
188
|
|
|
193
189
|
async def get_current_notifications(self) -> list[str]:
|
|
194
|
-
future: Future[list[UNNotification]] = Future() # type:ignore[valid-type]
|
|
190
|
+
future: Future[list[UNNotification]] = Future() # type: ignore[valid-type]
|
|
195
191
|
|
|
196
192
|
def handler(notifications: objc_id) -> None:
|
|
197
193
|
notifications = py_from_ns(notifications)
|
|
@@ -203,12 +199,12 @@ class CocoaNotificationCenter(DesktopNotifierBackend):
|
|
|
203
199
|
|
|
204
200
|
notifications = await asyncio.wrap_future(future)
|
|
205
201
|
identifiers = [
|
|
206
|
-
str(n.request.identifier) # type:ignore[attr-defined]
|
|
202
|
+
str(n.request.identifier) # type: ignore[attr-defined]
|
|
207
203
|
for n in notifications
|
|
208
204
|
]
|
|
209
205
|
|
|
210
206
|
for notification in notifications:
|
|
211
|
-
notification.autorelease() # type:ignore[attr-defined]
|
|
207
|
+
notification.autorelease() # type: ignore[attr-defined]
|
|
212
208
|
|
|
213
209
|
return identifiers
|
|
214
210
|
|
|
@@ -261,7 +257,7 @@ class CocoaNotificationCenter(DesktopNotifierBackend):
|
|
|
261
257
|
notification.identifier, content=content, trigger=None
|
|
262
258
|
)
|
|
263
259
|
|
|
264
|
-
future: Future[NSError] = Future() # type:ignore[valid-type]
|
|
260
|
+
future: Future[NSError] = Future() # type: ignore[valid-type]
|
|
265
261
|
|
|
266
262
|
def handler(error: objc_id) -> None:
|
|
267
263
|
ns_error = py_from_ns(error)
|
|
@@ -307,7 +303,7 @@ class CocoaNotificationCenter(DesktopNotifierBackend):
|
|
|
307
303
|
categories = await self._get_notification_categories()
|
|
308
304
|
category_ids = set(
|
|
309
305
|
py_from_ns(c.identifier)
|
|
310
|
-
for c in categories.allObjects() # type:ignore[attr-defined]
|
|
306
|
+
for c in categories.allObjects() # type: ignore[attr-defined]
|
|
311
307
|
)
|
|
312
308
|
|
|
313
309
|
# Register new category if necessary.
|
|
@@ -335,7 +331,7 @@ class CocoaNotificationCenter(DesktopNotifierBackend):
|
|
|
335
331
|
actions.append(action)
|
|
336
332
|
|
|
337
333
|
# Add category for new set of buttons.
|
|
338
|
-
new_categories = categories.setByAddingObject( # type:ignore[attr-defined]
|
|
334
|
+
new_categories = categories.setByAddingObject( # type: ignore[attr-defined]
|
|
339
335
|
UNNotificationCategory.categoryWithIdentifier(
|
|
340
336
|
category_id,
|
|
341
337
|
actions=actions,
|
|
@@ -347,9 +343,9 @@ class CocoaNotificationCenter(DesktopNotifierBackend):
|
|
|
347
343
|
|
|
348
344
|
return category_id
|
|
349
345
|
|
|
350
|
-
async def _get_notification_categories(self) -> NSSet: # type:ignore[valid-type]
|
|
346
|
+
async def _get_notification_categories(self) -> NSSet: # type: ignore[valid-type]
|
|
351
347
|
"""Returns the registered notification categories for this app / Python."""
|
|
352
|
-
future: Future[NSSet] = Future() # type:ignore[valid-type]
|
|
348
|
+
future: Future[NSSet] = Future() # type: ignore[valid-type]
|
|
353
349
|
|
|
354
350
|
def handler(categories: objc_id) -> None:
|
|
355
351
|
categories = py_from_ns(categories)
|
|
@@ -399,10 +395,10 @@ class CocoaNotificationCenter(DesktopNotifierBackend):
|
|
|
399
395
|
return frozenset(capabilities)
|
|
400
396
|
|
|
401
397
|
|
|
402
|
-
def log_nserror(error: NSError, prefix: str) -> None: # type:ignore[valid-type]
|
|
403
|
-
domain = str(error.domain) # type:ignore[attr-defined]
|
|
404
|
-
code = int(error.code) # type:ignore[attr-defined]
|
|
405
|
-
description = str(error.localizedDescription) # type:ignore[attr-defined]
|
|
398
|
+
def log_nserror(error: NSError, prefix: str) -> None: # type: ignore[valid-type]
|
|
399
|
+
domain = str(error.domain) # type: ignore[attr-defined]
|
|
400
|
+
code = int(error.code) # type: ignore[attr-defined]
|
|
401
|
+
description = str(error.localizedDescription) # type: ignore[attr-defined]
|
|
406
402
|
|
|
407
403
|
logger.warning(
|
|
408
404
|
"%s: domain=%s, code=%s, description=%s", prefix, domain, code, description
|
{desktop_notifier-6.1.1.dev0 → desktop_notifier-6.3.0}/src/desktop_notifier/backends/winrt.py
RENAMED
|
@@ -7,6 +7,7 @@ ctypes because the C winapi only supports basic notifications with a title and m
|
|
|
7
7
|
This backend therefore requires interaction with the Windows Runtime and uses the winrt
|
|
8
8
|
package with compiled components.
|
|
9
9
|
"""
|
|
10
|
+
|
|
10
11
|
from __future__ import annotations
|
|
11
12
|
|
|
12
13
|
import logging
|
|
@@ -14,8 +15,7 @@ import sys
|
|
|
14
15
|
import winreg
|
|
15
16
|
import asyncio
|
|
16
17
|
from collections.abc import Callable
|
|
17
|
-
from typing import TypeVar
|
|
18
|
-
from typing_extensions import ParamSpec
|
|
18
|
+
from typing import ParamSpec, TypeVar
|
|
19
19
|
from xml.etree.ElementTree import Element, SubElement, tostring
|
|
20
20
|
|
|
21
21
|
from winrt.system import Object as WinRTObject
|
|
@@ -51,7 +51,7 @@ BUTTON_ACTION_PREFIX = "action=button&id="
|
|
|
51
51
|
REPLY_TEXTBOX_NAME = "textBox"
|
|
52
52
|
|
|
53
53
|
|
|
54
|
-
def register_hkey(app_id: str, app_name: str) -> None:
|
|
54
|
+
def register_hkey(app_id: str, app_name: str, app_icon: Icon | None = None) -> None:
|
|
55
55
|
# mypy type guard
|
|
56
56
|
if not sys.platform == "win32":
|
|
57
57
|
return
|
|
@@ -60,6 +60,10 @@ def register_hkey(app_id: str, app_name: str) -> None:
|
|
|
60
60
|
key_path = f"SOFTWARE\\Classes\\AppUserModelId\\{app_id}"
|
|
61
61
|
with winreg.CreateKeyEx(winreg.HKEY_CURRENT_USER, key_path) as master_key:
|
|
62
62
|
winreg.SetValueEx(master_key, "DisplayName", 0, winreg.REG_SZ, app_name)
|
|
63
|
+
if app_icon is not None and app_icon.is_file():
|
|
64
|
+
winreg.SetValueEx(
|
|
65
|
+
master_key, "IconUri", 0, winreg.REG_SZ, app_icon.as_uri()
|
|
66
|
+
)
|
|
63
67
|
|
|
64
68
|
|
|
65
69
|
class WinRTDesktopNotifier(DesktopNotifierBackend):
|
|
@@ -90,9 +94,9 @@ class WinRTDesktopNotifier(DesktopNotifierBackend):
|
|
|
90
94
|
self.app_id = CoreApplication.id
|
|
91
95
|
else:
|
|
92
96
|
self.app_id = app_name
|
|
93
|
-
register_hkey(app_id=app_name, app_name=app_name)
|
|
97
|
+
register_hkey(app_id=app_name, app_name=app_name, app_icon=app_icon)
|
|
94
98
|
|
|
95
|
-
notifier = self.manager.
|
|
99
|
+
notifier = self.manager.create_toast_notifier(self.app_id)
|
|
96
100
|
|
|
97
101
|
if not notifier:
|
|
98
102
|
raise RuntimeError(f"Could not get ToastNotifier for app_id: {self.app_id}")
|
|
@@ -233,8 +237,6 @@ class WinRTDesktopNotifier(DesktopNotifierBackend):
|
|
|
233
237
|
if not sender:
|
|
234
238
|
return
|
|
235
239
|
|
|
236
|
-
notification = self._clear_notification_from_cache(sender.tag)
|
|
237
|
-
|
|
238
240
|
if not boxed_activated_args:
|
|
239
241
|
return
|
|
240
242
|
|
|
@@ -242,16 +244,14 @@ class WinRTDesktopNotifier(DesktopNotifierBackend):
|
|
|
242
244
|
action_id = activated_args.arguments
|
|
243
245
|
|
|
244
246
|
if action_id == DEFAULT_ACTION:
|
|
245
|
-
self.handle_clicked(sender.tag
|
|
246
|
-
|
|
247
|
+
self.handle_clicked(sender.tag)
|
|
247
248
|
elif action_id == REPLY_ACTION and activated_args.user_input:
|
|
248
249
|
boxed_reply = activated_args.user_input[REPLY_TEXTBOX_NAME]
|
|
249
250
|
reply = unbox_string(boxed_reply)
|
|
250
|
-
self.handle_replied(sender.tag, reply
|
|
251
|
-
|
|
251
|
+
self.handle_replied(sender.tag, reply)
|
|
252
252
|
elif action_id.startswith(BUTTON_ACTION_PREFIX):
|
|
253
253
|
button_id = action_id.replace(BUTTON_ACTION_PREFIX, "")
|
|
254
|
-
self.handle_button(sender.tag, button_id
|
|
254
|
+
self.handle_button(sender.tag, button_id)
|
|
255
255
|
|
|
256
256
|
def _on_dismissed(
|
|
257
257
|
self,
|
|
@@ -261,13 +261,11 @@ class WinRTDesktopNotifier(DesktopNotifierBackend):
|
|
|
261
261
|
if not sender:
|
|
262
262
|
return
|
|
263
263
|
|
|
264
|
-
notification = self._clear_notification_from_cache(sender.tag)
|
|
265
|
-
|
|
266
264
|
if (
|
|
267
265
|
dismissed_args
|
|
268
266
|
and dismissed_args.reason == ToastDismissalReason.USER_CANCELED
|
|
269
267
|
):
|
|
270
|
-
self.handle_dismissed(sender.tag
|
|
268
|
+
self.handle_dismissed(sender.tag)
|
|
271
269
|
|
|
272
270
|
def _on_failed(
|
|
273
271
|
self, sender: ToastNotification | None, failed_args: ToastFailedEventArgs | None
|
|
@@ -290,20 +288,18 @@ class WinRTDesktopNotifier(DesktopNotifierBackend):
|
|
|
290
288
|
Asynchronously removes a notification from the notification center.
|
|
291
289
|
"""
|
|
292
290
|
if self.manager.history:
|
|
293
|
-
self.manager.history.
|
|
294
|
-
identifier, DEFAULT_GROUP, self.app_id
|
|
295
|
-
)
|
|
291
|
+
self.manager.history.remove(identifier, DEFAULT_GROUP, self.app_id)
|
|
296
292
|
|
|
297
293
|
async def _clear_all(self) -> None:
|
|
298
294
|
"""
|
|
299
295
|
Asynchronously clears all notifications from notification center.
|
|
300
296
|
"""
|
|
301
297
|
if self.manager.history:
|
|
302
|
-
self.manager.history.
|
|
298
|
+
self.manager.history.clear(self.app_id)
|
|
303
299
|
|
|
304
300
|
async def get_current_notifications(self) -> list[str]:
|
|
305
301
|
if self.manager.history:
|
|
306
|
-
notifications = self.manager.history.
|
|
302
|
+
notifications = self.manager.history.get_history(self.app_id)
|
|
307
303
|
return [n.tag for n in notifications]
|
|
308
304
|
return await super().get_current_notifications()
|
|
309
305
|
|
|
@@ -324,7 +320,7 @@ class WinRTDesktopNotifier(DesktopNotifierBackend):
|
|
|
324
320
|
}
|
|
325
321
|
# Custom audio is support only starting with the Windows 10 Anniversary update.
|
|
326
322
|
# See https://learn.microsoft.com/en-us/windows/apps/design/shell/tiles-and-notifications/custom-audio-on-toasts#add-the-custom-audio.
|
|
327
|
-
if sys.getwindowsversion().build >= 1607: # type:ignore[attr-defined]
|
|
323
|
+
if sys.getwindowsversion().build >= 1607: # type: ignore[attr-defined]
|
|
328
324
|
capabilities.add(Capability.SOUND_FILE)
|
|
329
325
|
|
|
330
326
|
return frozenset(capabilities)
|
|
@@ -14,6 +14,8 @@ from pathlib import Path
|
|
|
14
14
|
from typing import Any, Callable
|
|
15
15
|
from urllib.parse import unquote, urlparse
|
|
16
16
|
|
|
17
|
+
from immutabledict import immutabledict
|
|
18
|
+
|
|
17
19
|
__all__ = [
|
|
18
20
|
"Capability",
|
|
19
21
|
"FileResource",
|
|
@@ -175,6 +177,10 @@ class Button:
|
|
|
175
177
|
identifier: str = dataclasses.field(default_factory=uuid_str)
|
|
176
178
|
"""A unique identifier to use in callbacks to specify with button was clicked"""
|
|
177
179
|
|
|
180
|
+
def __post_init__(self) -> None:
|
|
181
|
+
if self.identifier is None:
|
|
182
|
+
object.__setattr__(self, "identifier", uuid_str())
|
|
183
|
+
|
|
178
184
|
|
|
179
185
|
@dataclass(frozen=True)
|
|
180
186
|
class ReplyField:
|
|
@@ -212,55 +218,58 @@ class Notification:
|
|
|
212
218
|
message: str
|
|
213
219
|
"""Notification message"""
|
|
214
220
|
|
|
215
|
-
urgency: Urgency = Urgency.Normal
|
|
221
|
+
urgency: Urgency = field(default=Urgency.Normal, repr=False)
|
|
216
222
|
"""Notification urgency. Can determine stickiness, notification appearance and
|
|
217
223
|
break through silencing."""
|
|
218
224
|
|
|
219
|
-
icon: Icon | None = None
|
|
225
|
+
icon: Icon | None = field(default=None, repr=False)
|
|
220
226
|
"""Icon to use for the notification"""
|
|
221
227
|
|
|
222
|
-
buttons: tuple[Button, ...] = field(default_factory=tuple)
|
|
228
|
+
buttons: tuple[Button, ...] = field(default_factory=tuple, repr=False)
|
|
223
229
|
"""Buttons shown on an interactive notification"""
|
|
224
230
|
|
|
225
|
-
|
|
231
|
+
buttons_dict: immutabledict[str, Button] = field(
|
|
232
|
+
default_factory=immutabledict, init=False, repr=False, compare=False
|
|
233
|
+
)
|
|
234
|
+
"""Buttons shown on an interactive notification, indexed by button identifier"""
|
|
235
|
+
|
|
236
|
+
reply_field: ReplyField | None = field(default=None, repr=False)
|
|
226
237
|
"""Text field shown on an interactive notification. This can be used for example
|
|
227
238
|
for messaging apps to reply directly from the notification."""
|
|
228
239
|
|
|
229
|
-
on_dispatched: Callable[[], Any] | None = None
|
|
240
|
+
on_dispatched: Callable[[], Any] | None = field(default=None, repr=False)
|
|
230
241
|
"""Method to call when the notification was sent to the notifications server for display"""
|
|
231
242
|
|
|
232
|
-
on_clicked: Callable[[], Any] | None = None
|
|
243
|
+
on_clicked: Callable[[], Any] | None = field(default=None, repr=False)
|
|
233
244
|
"""Method to call when the notification is clicked"""
|
|
234
245
|
|
|
235
|
-
on_dismissed: Callable[[], Any] | None = None
|
|
246
|
+
on_dismissed: Callable[[], Any] | None = field(default=None, repr=False)
|
|
236
247
|
"""Method to call when the notification is dismissed"""
|
|
237
248
|
|
|
238
|
-
attachment: Attachment | None = None
|
|
249
|
+
attachment: Attachment | None = field(default=None, repr=False)
|
|
239
250
|
"""A file attached to the notification which may be displayed as a preview"""
|
|
240
251
|
|
|
241
|
-
sound: Sound | None = None
|
|
252
|
+
sound: Sound | None = field(default=None, repr=False)
|
|
242
253
|
"""A sound to play on notification"""
|
|
243
254
|
|
|
244
|
-
thread: str | None = None
|
|
255
|
+
thread: str | None = field(default=None, repr=False)
|
|
245
256
|
"""An identifier to group related notifications together, e.g., from a chat space"""
|
|
246
257
|
|
|
247
|
-
timeout: int =
|
|
258
|
+
timeout: int = field(default=-1, repr=False)
|
|
248
259
|
"""Duration in seconds for which the notification is shown"""
|
|
249
260
|
|
|
250
261
|
identifier: str = field(default_factory=uuid_str)
|
|
251
262
|
"""A unique identifier for this notification. Generated automatically if not
|
|
252
263
|
passed by the client."""
|
|
253
264
|
|
|
254
|
-
_buttons_dict: dict[str, Button] = field(default_factory=dict)
|
|
255
|
-
|
|
256
265
|
def __post_init__(self) -> None:
|
|
257
|
-
|
|
258
|
-
self
|
|
266
|
+
if self.identifier is None:
|
|
267
|
+
object.__setattr__(self, "identifier", uuid_str())
|
|
259
268
|
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
269
|
+
object.__setattr__(
|
|
270
|
+
self,
|
|
271
|
+
"buttons_dict",
|
|
272
|
+
immutabledict({button.identifier: button for button in self.buttons}),
|
|
264
273
|
)
|
|
265
274
|
|
|
266
275
|
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
"""
|
|
3
3
|
Asynchronous desktop notification API
|
|
4
4
|
"""
|
|
5
|
+
|
|
5
6
|
from __future__ import annotations
|
|
6
7
|
|
|
7
|
-
import asyncio
|
|
8
8
|
import logging
|
|
9
9
|
import platform
|
|
10
10
|
import warnings
|
|
@@ -45,9 +45,6 @@ logger = logging.getLogger(__name__)
|
|
|
45
45
|
T = TypeVar("T")
|
|
46
46
|
|
|
47
47
|
|
|
48
|
-
default_event_loop_policy = asyncio.DefaultEventLoopPolicy()
|
|
49
|
-
|
|
50
|
-
|
|
51
48
|
def get_backend_class() -> Type[DesktopNotifierBackend]:
|
|
52
49
|
"""
|
|
53
50
|
Return the backend class depending on the platform and version.
|
|
@@ -299,6 +296,9 @@ class DesktopNotifier:
|
|
|
299
296
|
|
|
300
297
|
If the notification itself already specifies an on_clicked handler, it will be
|
|
301
298
|
used instead of the class-level handler.
|
|
299
|
+
|
|
300
|
+
..note:: On Linux, notifications servers might signal events of other
|
|
301
|
+
applications as well and will lead to executing this callback.
|
|
302
302
|
"""
|
|
303
303
|
return self._backend.on_clicked
|
|
304
304
|
|
|
@@ -315,6 +315,9 @@ class DesktopNotifier:
|
|
|
315
315
|
|
|
316
316
|
If the notification itself already specifies an on_dismissed handler, it will be
|
|
317
317
|
used instead of the class-level handler.
|
|
318
|
+
|
|
319
|
+
..note:: On Linux, notifications servers might signal events of other
|
|
320
|
+
applications as well and will lead to executing this callback.
|
|
318
321
|
"""
|
|
319
322
|
return self._backend.on_dismissed
|
|
320
323
|
|
|
@@ -332,6 +335,9 @@ class DesktopNotifier:
|
|
|
332
335
|
|
|
333
336
|
If the notification button itself already specifies an on_pressed handler, it
|
|
334
337
|
will be used instead of the class-level handler.
|
|
338
|
+
|
|
339
|
+
..note:: On Linux, notifications servers might signal events of other
|
|
340
|
+
applications as well and will lead to executing this callback.
|
|
335
341
|
"""
|
|
336
342
|
return self._backend.on_button_pressed
|
|
337
343
|
|
|
@@ -348,6 +354,9 @@ class DesktopNotifier:
|
|
|
348
354
|
|
|
349
355
|
If the notification's reply field itself already specifies an on_replied
|
|
350
356
|
handler, it will be used instead of the class-level handler.
|
|
357
|
+
|
|
358
|
+
..note:: On Linux, notifications servers might signal events of other
|
|
359
|
+
applications as well and will lead to executing this callback.
|
|
351
360
|
"""
|
|
352
361
|
return self._backend.on_replied
|
|
353
362
|
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
"""
|
|
3
3
|
Synchronous desktop notification API
|
|
4
4
|
"""
|
|
5
|
+
|
|
5
6
|
from __future__ import annotations
|
|
6
7
|
|
|
7
8
|
import asyncio
|
|
@@ -142,3 +143,48 @@ class DesktopNotifierSync:
|
|
|
142
143
|
"""See :meth:`desktop_notifier.main.DesktopNotifier.get_capabilities`"""
|
|
143
144
|
coro = self._async_api.get_capabilities()
|
|
144
145
|
return self._run_coro_sync(coro)
|
|
146
|
+
|
|
147
|
+
@property
|
|
148
|
+
def on_dispatched(self) -> Callable[[str], Any] | None:
|
|
149
|
+
"""See :meth:`desktop_notifier.main.DesktopNotifier.on_dispatched`"""
|
|
150
|
+
return self._async_api.on_dispatched
|
|
151
|
+
|
|
152
|
+
@on_dispatched.setter
|
|
153
|
+
def on_dispatched(self, handler: Callable[[str], Any] | None) -> None:
|
|
154
|
+
self._async_api.on_dispatched = handler
|
|
155
|
+
|
|
156
|
+
@property
|
|
157
|
+
def on_clicked(self) -> Callable[[str], Any] | None:
|
|
158
|
+
"""See :meth:`desktop_notifier.main.DesktopNotifier.on_clicked`"""
|
|
159
|
+
return self._async_api.on_clicked
|
|
160
|
+
|
|
161
|
+
@on_clicked.setter
|
|
162
|
+
def on_clicked(self, handler: Callable[[str], Any] | None) -> None:
|
|
163
|
+
self._async_api.on_clicked = handler
|
|
164
|
+
|
|
165
|
+
@property
|
|
166
|
+
def on_dismissed(self) -> Callable[[str], Any] | None:
|
|
167
|
+
"""See :meth:`desktop_notifier.main.DesktopNotifier.on_dismissed`"""
|
|
168
|
+
return self._async_api.on_dismissed
|
|
169
|
+
|
|
170
|
+
@on_dismissed.setter
|
|
171
|
+
def on_dismissed(self, handler: Callable[[str], Any] | None) -> None:
|
|
172
|
+
self._async_api.on_dismissed = handler
|
|
173
|
+
|
|
174
|
+
@property
|
|
175
|
+
def on_button_pressed(self) -> Callable[[str, str], Any] | None:
|
|
176
|
+
"""See :meth:`desktop_notifier.main.DesktopNotifier.on_button_pressed`"""
|
|
177
|
+
return self._async_api.on_button_pressed
|
|
178
|
+
|
|
179
|
+
@on_button_pressed.setter
|
|
180
|
+
def on_button_pressed(self, handler: Callable[[str, str], Any] | None) -> None:
|
|
181
|
+
self._async_api.on_button_pressed = handler
|
|
182
|
+
|
|
183
|
+
@property
|
|
184
|
+
def on_replied(self) -> Callable[[str, str], Any] | None:
|
|
185
|
+
"""See :meth:`desktop_notifier.main.DesktopNotifier.on_replied`"""
|
|
186
|
+
return self._async_api.on_replied
|
|
187
|
+
|
|
188
|
+
@on_replied.setter
|
|
189
|
+
def on_replied(self, handler: Callable[[str, str], Any] | None) -> None:
|
|
190
|
+
self._async_api.on_replied = handler
|
{desktop_notifier-6.1.1.dev0 → desktop_notifier-6.3.0/src/desktop_notifier.egg-info}/PKG-INFO
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: desktop-notifier
|
|
3
|
-
Version: 6.
|
|
3
|
+
Version: 6.3.0
|
|
4
4
|
Summary: Python library for cross-platform desktop notifications
|
|
5
5
|
Author-email: Sam Schott <sam.schott@outlook.com>
|
|
6
6
|
License-Expression: MIT
|
|
@@ -13,31 +13,31 @@ Classifier: Operating System :: MacOS :: MacOS X
|
|
|
13
13
|
Classifier: Operating System :: Microsoft :: Windows
|
|
14
14
|
Classifier: Operating System :: OS Independent
|
|
15
15
|
Classifier: Programming Language :: Python :: 3
|
|
16
|
-
Classifier: Programming Language :: Python :: 3.9
|
|
17
|
-
Classifier: Programming Language :: Python :: 3.10
|
|
18
16
|
Classifier: Programming Language :: Python :: 3.11
|
|
19
17
|
Classifier: Programming Language :: Python :: 3.12
|
|
20
18
|
Classifier: Programming Language :: Python :: 3.13
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.15
|
|
21
21
|
Classifier: Programming Language :: Python :: 3 :: Only
|
|
22
22
|
Classifier: Topic :: Communications
|
|
23
23
|
Classifier: Topic :: Desktop Environment
|
|
24
24
|
Classifier: Topic :: Desktop Environment :: Gnome
|
|
25
25
|
Classifier: Topic :: Desktop Environment :: K Desktop Environment (KDE)
|
|
26
26
|
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
27
|
-
Requires-Python: >=3.
|
|
27
|
+
Requires-Python: >=3.11
|
|
28
28
|
Description-Content-Type: text/markdown
|
|
29
29
|
License-File: LICENSE
|
|
30
|
-
Requires-Dist: bidict
|
|
30
|
+
Requires-Dist: bidict>=0.24.1
|
|
31
31
|
Requires-Dist: packaging
|
|
32
|
-
Requires-Dist:
|
|
33
|
-
Requires-Dist: dbus-fast; sys_platform == "linux"
|
|
34
|
-
Requires-Dist: rubicon-objc>=0.5; sys_platform == "darwin"
|
|
35
|
-
Requires-Dist: winrt-runtime>=
|
|
36
|
-
Requires-Dist: winrt-windows.applicationmodel.core>=
|
|
37
|
-
Requires-Dist: winrt-windows.data.xml.dom>=
|
|
38
|
-
Requires-Dist: winrt-windows.foundation>=
|
|
39
|
-
Requires-Dist: winrt-windows.foundation.collections>=
|
|
40
|
-
Requires-Dist: winrt-windows.ui.notifications>=
|
|
32
|
+
Requires-Dist: immutabledict
|
|
33
|
+
Requires-Dist: dbus-fast>=5.0; sys_platform == "linux"
|
|
34
|
+
Requires-Dist: rubicon-objc>=0.5.7; sys_platform == "darwin"
|
|
35
|
+
Requires-Dist: winrt-runtime>=4.0.1; sys_platform == "win32"
|
|
36
|
+
Requires-Dist: winrt-windows.applicationmodel.core>=4.0.1; sys_platform == "win32"
|
|
37
|
+
Requires-Dist: winrt-windows.data.xml.dom>=4.0.1; sys_platform == "win32"
|
|
38
|
+
Requires-Dist: winrt-windows.foundation>=4.0.1; sys_platform == "win32"
|
|
39
|
+
Requires-Dist: winrt-windows.foundation.collections>=4.0.1; sys_platform == "win32"
|
|
40
|
+
Requires-Dist: winrt-windows.ui.notifications>=4.0.1; sys_platform == "win32"
|
|
41
41
|
Provides-Extra: dev
|
|
42
42
|
Requires-Dist: black; extra == "dev"
|
|
43
43
|
Requires-Dist: bump2version; extra == "dev"
|
|
@@ -46,12 +46,12 @@ Requires-Dist: flake8-pyproject; extra == "dev"
|
|
|
46
46
|
Requires-Dist: isort; extra == "dev"
|
|
47
47
|
Requires-Dist: mypy; extra == "dev"
|
|
48
48
|
Requires-Dist: pytest; extra == "dev"
|
|
49
|
-
Requires-Dist: pytest-asyncio; extra == "dev"
|
|
49
|
+
Requires-Dist: pytest-asyncio>=1.4.1; extra == "dev"
|
|
50
50
|
Requires-Dist: pytest-cov; extra == "dev"
|
|
51
51
|
Provides-Extra: docs
|
|
52
|
-
Requires-Dist: furo==
|
|
53
|
-
Requires-Dist: sphinx==
|
|
54
|
-
Requires-Dist: sphinx-autoapi==3.
|
|
52
|
+
Requires-Dist: furo==2025.12.19; extra == "docs"
|
|
53
|
+
Requires-Dist: sphinx==9.2.0; extra == "docs"
|
|
54
|
+
Requires-Dist: sphinx-autoapi==3.9.0; extra == "docs"
|
|
55
55
|
Requires-Dist: sphinx-mdinclude==0.6.2; extra == "docs"
|
|
56
56
|
Dynamic: license-file
|
|
57
57
|
|
|
@@ -175,10 +175,10 @@ Foundation CFRunLoop with asyncio:
|
|
|
175
175
|
|
|
176
176
|
```Python
|
|
177
177
|
import asyncio
|
|
178
|
-
from rubicon.objc.eventloop import
|
|
178
|
+
from rubicon.objc.eventloop import RubiconEventLoop
|
|
179
179
|
|
|
180
|
-
|
|
181
|
-
|
|
180
|
+
with asyncio.Runner(loop_factory=RubiconEventLoop) as runner:
|
|
181
|
+
runner.run(main())
|
|
182
182
|
```
|
|
183
183
|
|
|
184
184
|
Desktop-notifier itself uses Rubicon Objective-C to interface with Cocoa APIs. A full
|
|
@@ -226,6 +226,6 @@ This package is opinionated in a few ways:
|
|
|
226
226
|
|
|
227
227
|
## Dependencies
|
|
228
228
|
|
|
229
|
-
* [dbus-
|
|
229
|
+
* [dbus-fast](https://github.com/Bluetooth-Devices/dbus-fast) on Linux
|
|
230
230
|
* [rubicon-objc](https://github.com/beeware/rubicon-objc) on macOS
|
|
231
231
|
* [pywinrt](https://github.com/pywinrt/pywinrt) on Windows
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
bidict>=0.24.1
|
|
2
|
+
packaging
|
|
3
|
+
immutabledict
|
|
4
|
+
|
|
5
|
+
[:sys_platform == "darwin"]
|
|
6
|
+
rubicon-objc>=0.5.7
|
|
7
|
+
|
|
8
|
+
[:sys_platform == "linux"]
|
|
9
|
+
dbus-fast>=5.0
|
|
10
|
+
|
|
11
|
+
[:sys_platform == "win32"]
|
|
12
|
+
winrt-runtime>=4.0.1
|
|
13
|
+
winrt-windows.applicationmodel.core>=4.0.1
|
|
14
|
+
winrt-windows.data.xml.dom>=4.0.1
|
|
15
|
+
winrt-windows.foundation>=4.0.1
|
|
16
|
+
winrt-windows.foundation.collections>=4.0.1
|
|
17
|
+
winrt-windows.ui.notifications>=4.0.1
|
|
18
|
+
|
|
19
|
+
[dev]
|
|
20
|
+
black
|
|
21
|
+
bump2version
|
|
22
|
+
flake8
|
|
23
|
+
flake8-pyproject
|
|
24
|
+
isort
|
|
25
|
+
mypy
|
|
26
|
+
pytest
|
|
27
|
+
pytest-asyncio>=1.4.1
|
|
28
|
+
pytest-cov
|
|
29
|
+
|
|
30
|
+
[docs]
|
|
31
|
+
furo==2025.12.19
|
|
32
|
+
sphinx==9.2.0
|
|
33
|
+
sphinx-autoapi==3.9.0
|
|
34
|
+
sphinx-mdinclude==0.6.2
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
bidict
|
|
2
|
-
packaging
|
|
3
|
-
typing-extensions
|
|
4
|
-
|
|
5
|
-
[:sys_platform == "darwin"]
|
|
6
|
-
rubicon-objc>=0.5
|
|
7
|
-
|
|
8
|
-
[:sys_platform == "linux"]
|
|
9
|
-
dbus-fast
|
|
10
|
-
|
|
11
|
-
[:sys_platform == "win32"]
|
|
12
|
-
winrt-runtime>=3.1
|
|
13
|
-
winrt-windows.applicationmodel.core>=3.1
|
|
14
|
-
winrt-windows.data.xml.dom>=3.1
|
|
15
|
-
winrt-windows.foundation>=3.1
|
|
16
|
-
winrt-windows.foundation.collections>=3.1
|
|
17
|
-
winrt-windows.ui.notifications>=3.1
|
|
18
|
-
|
|
19
|
-
[dev]
|
|
20
|
-
black
|
|
21
|
-
bump2version
|
|
22
|
-
flake8
|
|
23
|
-
flake8-pyproject
|
|
24
|
-
isort
|
|
25
|
-
mypy
|
|
26
|
-
pytest
|
|
27
|
-
pytest-asyncio
|
|
28
|
-
pytest-cov
|
|
29
|
-
|
|
30
|
-
[docs]
|
|
31
|
-
furo==2024.8.6
|
|
32
|
-
sphinx==8.1.3
|
|
33
|
-
sphinx-autoapi==3.6.0
|
|
34
|
-
sphinx-mdinclude==0.6.2
|
|
File without changes
|
|
File without changes
|
{desktop_notifier-6.1.1.dev0 → desktop_notifier-6.3.0}/src/desktop_notifier/backends/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{desktop_notifier-6.1.1.dev0 → desktop_notifier-6.3.0}/src/desktop_notifier/resources/__init__.py
RENAMED
|
File without changes
|
{desktop_notifier-6.1.1.dev0 → desktop_notifier-6.3.0}/src/desktop_notifier/resources/python.png
RENAMED
|
File without changes
|
{desktop_notifier-6.1.1.dev0 → desktop_notifier-6.3.0}/src/desktop_notifier.egg-info/SOURCES.txt
RENAMED
|
File without changes
|
|
File without changes
|
{desktop_notifier-6.1.1.dev0 → desktop_notifier-6.3.0}/src/desktop_notifier.egg-info/top_level.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|