Skip to content

fix(config): let --exclude-titles and --exclude-apps be repeated - #173

Merged
ErikBjare merged 1 commit into
ActivityWatch:masterfrom
andreivince:fix/exclude-titles-repeat
Nov 4, 2026
Merged

ErikBjare merged 1 commit into
ActivityWatch:masterfrom
andreivince:fix/exclude-titles-repeat

Conversation

@andreivince

Copy link
Copy Markdown
Contributor

The help for --exclude-titles says "Can specify multiple times", but argparse kept only the last occurrence. With --exclude-titles bank --exclude-titles password, titles matching bank were still logged. --exclude-apps, described in #156 as taking multiple patterns, had the same problem: only the last app was excluded.

Both flags now use action="extend", so every occurrence counts, and several patterns after one flag still work. The config values are applied after parsing, because with extend argparse would add the command line patterns to the config list instead of replacing it (and fail on an invalid config value). Patterns given on the command line still replace the ones from the config file, as before.

Added a test for both flags in tests/test_config.py. It fails on master (only the last flag's patterns are kept) and passes with the fix. I also ran the real main() with fake windows against a testing-mode aw-server-rust: before, a "Bank ..." title and a KeePassXC window were recorded; after, the title is excluded and the app isn't logged. The command for the macOS Swift helper now gets all the patterns too.

make test passes on macOS with Python 3.9. Haven't tested Linux or Windows.

The help text says --exclude-titles can be specified multiple times, but
argparse kept only the last occurrence, so with
`--exclude-titles bank --exclude-titles password` titles matching "bank"
were still logged. --exclude-apps had the same problem. Use
action="extend" so every occurrence counts. Patterns given on the
command line still replace the ones from the config file.
Copilot AI balanced review requested due to automatic review settings October 25, 2026 16:14

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.

@greptile-apps

greptile-apps Bot commented Oct 25, 2026 •

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge.

Summary

Repeated --exclude-titles and --exclude-apps flags now keep every supplied pattern.

  • Repeated exclusion flags keep every title and app pattern in the filter list.

No actionable issues found. Tests were inspected but not run.

Reviews (1) · Last reviewed commit: "fix(config): let --exclude-titles and --..." · Reviewed by Greptile

@ErikBjare
ErikBjare merged commit b376ad9 into ActivityWatch:master Nov 4, 2026
5 of 7 checks passed
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.

3 participants