From 61ea2bb237de6ed4ffd5b58900de2148f7f49665 Mon Sep 17 00:00:00 2001 From: Sam Estep Date: Tue, 19 May 2026 00:23:29 -0400 Subject: [PATCH] aw-notify: fix Darwin build Assisted-by: Codex:gpt-5.5 (cherry picked from commit f403883c2d27eb50e45ead906a8880ec5ebce27b) --- .../aw-notify-desktop-notifier-6.patch | 72 +++++++++++++++++++ .../office/activitywatch/default.nix | 6 ++ 2 files changed, 78 insertions(+) create mode 100644 pkgs/applications/office/activitywatch/aw-notify-desktop-notifier-6.patch diff --git a/pkgs/applications/office/activitywatch/aw-notify-desktop-notifier-6.patch b/pkgs/applications/office/activitywatch/aw-notify-desktop-notifier-6.patch new file mode 100644 index 000000000000..3d1f7d8a7ac4 --- /dev/null +++ b/pkgs/applications/office/activitywatch/aw-notify-desktop-notifier-6.patch @@ -0,0 +1,72 @@ +diff --git a/aw_notify/main.py b/aw_notify/main.py +index c749725..44dce5a 100644 +--- a/aw_notify/main.py ++++ b/aw_notify/main.py +@@ -3,6 +3,7 @@ + and send notifications to the user on predefined conditions. + """ + ++import asyncio + import logging + import sys + import threading +@@ -23,7 +24,7 @@ + import aw_client.queries + import click + from aw_core.log import setup_logging +-from desktop_notifier import DesktopNotifier ++from desktop_notifier import DesktopNotifier, Icon + from typing_extensions import TypeAlias + + logger = logging.getLogger(__name__) +@@ -149,11 +150,20 @@ def notify(title: str, msg: str): + if notifier is None: + notifier = DesktopNotifier( + app_name="AW", +- app_icon=f"file://{icon_path}", ++ app_icon=Icon(uri=f"file://{icon_path}"), + notification_limit=10, + ) + + logger.info(f'Showing: "{title} - {msg}"') +- notifier.send_sync(title=title, message=msg) ++ ++ # Get or create event loop ++ try: ++ loop = asyncio.get_running_loop() ++ except RuntimeError: ++ loop = asyncio.new_event_loop() ++ asyncio.set_event_loop(loop) ++ ++ # Send notification ++ loop.run_until_complete(notifier.send(title=title, message=msg)) + + + class CategoryAlert: +diff --git a/pyproject.toml b/pyproject.toml +index 314fe2f..0d6d5a9 100644 +--- a/pyproject.toml ++++ b/pyproject.toml +@@ -13,15 +13,15 @@ packages = [{include = "aw_notify"}] + aw-notify = "aw_notify.main:main" + + [tool.poetry.dependencies] +-python = "^3.9,<3.12" +-aw-client = "^0.5.13" +-desktop-notifier = "^3.4.2" +-rubicon-objc = { version = "^0.4.0", platform = "darwin" } ++python = ">=3.9,<3.14" ++aw-client = "^0.5.15" ++desktop-notifier = "^6.0.0" ++rubicon-objc = { version = "^0.5.0", platform = "darwin" } + + [tool.poetry.group.dev.dependencies] + black = "*" + mypy = "*" +-pyinstaller = "^6.6" +-pytest = "^7.4" ++pyinstaller = "^6.12.0" ++pytest = "*" + + [build-system] + requires = ["poetry-core"] diff --git a/pkgs/applications/office/activitywatch/default.nix b/pkgs/applications/office/activitywatch/default.nix index fbd26fb5d8b7..a1d2ec066635 100644 --- a/pkgs/applications/office/activitywatch/default.nix +++ b/pkgs/applications/office/activitywatch/default.nix @@ -159,6 +159,12 @@ rec { pyproject = true; build-system = [ python3Packages.poetry-core ]; + patches = [ + # Backport desktop-notifier 6 / rubicon-objc 0.5 support. + # https://github.com/ActivityWatch/aw-notify/pull/10 + ./aw-notify-desktop-notifier-6.patch + ]; + dependencies = with python3Packages; [ aw-client desktop-notifier