From 6f0cc8ec0e2c80f0776331f851138b50f7c2bdc8 Mon Sep 17 00:00:00 2001 From: Rick Morgans Date: Tue, 1 Sep 2026 19:13:08 +0930 Subject: [PATCH] feat: add --host and --port options aw-tauri passes `--port ` to autostarted modules whenever its server is not on the default port 5600: } else if server_port != 5600 { command.args(["--port", server_port.to_string().as_str()]); } aw-watcher-input accepted only `--testing` and `--help`, so it exited with `Error: No such option: --port` and aw-tauri retried it until it gave up. The watcher therefore could not be supervised by aw-tauri on any non-default port, including the standard testing port 5666. ActivityWatchClient already takes `host` and `port`, so this just exposes and forwards them. `--host` is included alongside `--port` to match aw-watcher-afk, which has offered both for the same reason. Typed with Optional rather than `X | None` to stay within the declared `python = "^3.8"`. Verified on macOS 26.6.2 (Apple Silicon), ActivityWatch 0.14.0b4: - before: aw-tauri on 5666 fails to start the released watcher, and aw-watcher-input_ is absent while the afk and window buckets exist - after: `aw-watcher-input --port 5666` connects, creates its bucket on 5666, and records events with real input data - `make typecheck` clean, black reports no changes, `--help` exits 0 --- src/aw_watcher_input/main.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/aw_watcher_input/main.py b/src/aw_watcher_input/main.py index e005209..3e220d3 100644 --- a/src/aw_watcher_input/main.py +++ b/src/aw_watcher_input/main.py @@ -1,6 +1,7 @@ import logging from datetime import datetime, timezone from time import sleep +from typing import Optional import aw_client import click @@ -11,11 +12,17 @@ @click.command() +@click.option("--host", default=None, help="Hostname of the aw-server to connect to.") +@click.option( + "--port", default=None, type=int, help="Port of the aw-server to connect to." +) @click.option("--testing", is_flag=True) -def main(testing: bool): +def main(testing: bool, host: Optional[str], port: Optional[int]): logging.basicConfig(level=logging.INFO) logger.info("Starting watcher...") - client = aw_client.ActivityWatchClient("aw-watcher-input", testing=testing) + client = aw_client.ActivityWatchClient( + "aw-watcher-input", testing=testing, host=host, port=port + ) client.wait_for_start() client.connect()