Skip to content

Commit c640ee3

Browse files
committed
fix: added potential workaround for failing NSBundle bundleIdentifier check in desktop-notifier
1 parent d1d0dec commit c640ee3

File tree

3 files changed

+13
-1
lines changed

3 files changed

+13
-1
lines changed

aw_notify/main.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
and send notifications to the user on predefined conditions.
44
"""
55
import logging
6+
import platform
67
import threading
78
from collections import defaultdict
89
from datetime import datetime, timedelta, timezone
@@ -252,6 +253,16 @@ def main(ctx, verbose: bool, testing: bool):
252253
logging.getLogger("urllib3").setLevel(logging.WARNING)
253254
logger.info("Starting...")
254255

256+
# set NSBundle on macOS, needed for desktop-notifier
257+
if platform.system() == "Darwin":
258+
from rubicon.objc import ObjCClass
259+
260+
# needs to be the same as the one in the PyInstaller config (later Info.plist)
261+
# could also be done by just monkey-patching the helper function is_signed_bundle in desktop-notifier
262+
# see: https://github.com/samschott/desktop-notifier/issues/115
263+
NSBundle = ObjCClass("NSBundle")
264+
NSBundle.mainBundle.bundleIdentifier = "net.activitywatch.ActivityWatch"
265+
255266
if ctx.invoked_subcommand is None:
256267
ctx.invoke(start)
257268

poetry.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ aw-notify = "aw_notify.main:main"
1616
python = "^3.9,<3.12"
1717
aw-client = "^0.5.13"
1818
desktop-notifier = "^3.4.2"
19+
rubicon-objc = { version = "^0.4.0", platform = "darwin" }
1920

2021
[tool.poetry.group.dev.dependencies]
2122
black = "*"

0 commit comments

Comments
 (0)