From 2a4b3300a33cc93e9efed1def2ed45292af46fcb Mon Sep 17 00:00:00 2001 From: Bob Date: Wed, 4 Mar 2026 10:55:24 +0000 Subject: [PATCH] fix(macos): fall back to jxa strategy when title exclusion is configured The swift strategy uses a native binary subprocess that sends heartbeats directly to the AW server, bypassing all Python filtering. When a user sets exclude_title=true or exclude_titles=[...] in the config, the swift strategy silently ignores these settings. Fix: detect title exclusion config before starting, and fall back to the jxa strategy with a warning message. The jxa strategy runs through Python's heartbeat_loop which properly applies exclude_title filtering. Fixes ActivityWatch/activitywatch#1141 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- aw_watcher_window/main.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/aw_watcher_window/main.py b/aw_watcher_window/main.py index b00f678..502e06e 100644 --- a/aw_watcher_window/main.py +++ b/aw_watcher_window/main.py @@ -72,6 +72,19 @@ def main(): client.wait_for_start() with client: + # On macOS, the swift strategy uses a native binary that bypasses Python filtering. + # Fall back to jxa if title exclusion is configured, so exclude_title/exclude_titles work. + if ( + sys.platform == "darwin" + and args.strategy == "swift" + and (args.exclude_title or args.exclude_titles) + ): + logger.warning( + "exclude_title/exclude_titles is not supported with the swift strategy; " + "falling back to jxa strategy" + ) + args.strategy = "jxa" + if sys.platform == "darwin" and args.strategy == "swift": logger.info("Using swift strategy, calling out to swift binary") binpath = os.path.join(