Skip to content

Add --port (and --host) so aw-tauri can supervise on non-default ports - #40

Open
rmorgans wants to merge 1 commit into
ActivityWatch:masterfrom
rmorgans:feat/port-option
Open

Add --port (and --host) so aw-tauri can supervise on non-default ports#40
rmorgans wants to merge 1 commit into
ActivityWatch:masterfrom
rmorgans:feat/port-option

Conversation

@rmorgans

@rmorgans rmorgans commented Sep 1, 2026

Copy link
Copy Markdown

Problem

aw-tauri passes --port <n> to autostarted modules whenever its server uses a non-default port (manager.rs#L737-L745):

// Use custom args if provided, otherwise only pass port arg if it's not the default (5600)
if let Some(ref args) = custom_args {
    command.args(args);
} else if server_port != 5600 {
    command.args(["--port", server_port.to_string().as_str()]);
}

aw-watcher-input accepted only --testing and --help, so it cannot be supervised by aw-tauri on any non-default port — including the standard testing port 5666. It is the only bundled watcher with this gap; aw-watcher-afk and aw-watcher-window both take --port.

Reproduction

  • ActivityWatch v0.14.0b4 (Tauri, macOS arm64), aw-watcher-input 0.1.0
  • macOS 26.6.2, Apple Silicon
  • aw-tauri server port 5666

With aw-watcher-input in the autostart list, aw-tauri logs:

Error: No such option: --port

Usage: aw-watcher-input [OPTIONS]

Options:
  --testing
  --help

aw-tauri retries and then leaves the module stopped. Measured on 5666: the aw-watcher-afk_<host> and aw-watcher-window_<host> buckets are created, aw-watcher-input_<host> is absent, and no input events are collected.

At the default port 5600 no argument is injected and the watcher runs correctly, so this only affects non-default ports.

Fix

ActivityWatchClient already accepts host and port, so this exposes and forwards them. --host is included alongside --port to match aw-watcher-afk, which offers both.

Typed with Optional[...] rather than X | None to stay within the declared python = "^3.8".

Verification

On the same machine and build:

result
Before, aw-tauri on 5666 released watcher fails with No such option: --port; input bucket absent
After, aw-watcher-input --port 5666 connects, creates aw-watcher-input_<host> on 5666, records events with real input data
make typecheck Success: no issues found in 3 source files
black --check 1 file would be left unchanged
aw-watcher-input --help exits 0 (what make test asserts)

Confirmed the events landed on the 5666 server rather than the one on 5600.

Workarounds, for anyone hitting this before it lands

  • Keep aw-tauri on its default port 5600.
  • For the testing port specifically, configure the module with args = "--testing" — explicit custom_args stop aw-tauri injecting --port. That does not help for arbitrary non-default ports.

🤖 Generated with Claude Code

aw-tauri passes `--port <n>` 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_<host> 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
@greptile-apps

greptile-apps Bot commented Sep 1, 2026

Copy link
Copy Markdown

Greptile Summary

Exposes the ActivityWatch server address through the watcher CLI so supervisors can run it against non-default endpoints.

  • Adds optional --host and integer --port options.
  • Forwards both options to ActivityWatchClient.
  • Preserves existing production and testing defaults when the options are omitted.

Confidence Score: 5/5

The PR appears safe to merge with no actionable defects identified.

The new options match the client’s accepted argument types and override semantics, while omitted values continue to resolve through the existing production or testing configuration.

Important Files Changed

Filename Overview
src/aw_watcher_input/main.py Adds compatible host and port CLI overrides while preserving the client’s existing fallback behavior.

Reviews (1): Last reviewed commit: "feat: add --host and --port options" | Re-trigger Greptile

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant