[Feature] Add `exclude_titles` feature for enhanced window title exclusion
This commit introduces the --exclude-titles argument to the aw-watcher-window module, allowing users to specify a list of window titles or regular expression patterns to exclude from tracking. This new feature is designed to complement the existing --exclude-title flag, providing enhanced flexibility for users who need to exclude multiple window titles without breaking compatibility with existing configurations.
Key Changes:
- Added the
--exclude-titlesargument to the argparse configuration inconfig.py, enabling the specification of multiple exclusion patterns. - Updated the
heartbeat_loopfunction inmain.pyto support bothexclude_titleandexclude_titles, withexclude_titlesallowing for an array of titles to be excluded. - Utilized the
remodule for regex pattern matching against window titles, ensuring case-insensitive comparisons.
This enhancement ensures that users can now more precisely control which window titles are excluded from tracking, making the aw-watcher-window module more versatile and user-friendly.
I have been using this feature since I opened this PR and have not had any problems so far
@ellipsis-dev Can you review this, and the re.escape part specifically? Doesn't it neuter actual regexes?
@ErikBjare, I have addressed your comments in pull request https://github.com/ActivityWatch/aw-watcher-window/pull/102
It seems Ellipsis wanted to put the compile in a try/except, which is probably a good idea (although it messed up the syntax).
But, unlike what it did in its PR, it should print a warning if regex fails to compile (maybe even exit(1)), not silently escape the pattern.