Skip to content

Different interpretation of regex in the Activity and Timeline sections #939

Open

Description

@arshanskiyav

Hi, everyone.

ActivityWatch version: v0.13.2
Modules: aw-server,aw-watcher-window,aw-watcher-afk
OS: Windows 10

I need to split an activity between clients. To do this, I use a category with the regex app_name.*unic_word_for_app_from_title.*. This works for the timeline, but not for the activity.

Example:
Name: TG
Parent: AKARN
App: telegram.exe
Words: AKARN,Elena V
Regex: telegram.exe.*(AKARN|Elena V).*
Case insensitive: True
Color: green

Name: TG
Parent: ACG
App: telegram.exe
Words: ACG,Admin V
Regex: telegram.exe.*(ACG|Admin V).*
Case insensitive: True
Color: dark cyan

I see a split in the timeline:

Image

ImageImage

But not in activities:

Image Image

Activity

  1. TimeToBuildBob commented on Aug 28, 2026

    @TimeToBuildBob
    Contributor

    Thanks for the report — I reproduced this with a fixture (two telegram events that differ only in title, plus your two TG rules).

    The two views do not run the same matcher. It is not merge-order.

    • Timeline colors via app + '\n' + title (getCategorizationStringFromEvent → matchString, flags im). . does not match the newline.
    • Activity runs categorize() on unmerged window events, then displays merged-by-$category. The server tests each field separately (app, then title, …). No field contains both telegram.exe and AKARN, so the combined regex misses.

    For telegram.exe.*(AKARN|Elena V).* / telegram.exe.*(ACG|Admin V).*, both paths miss. Timeline still looks split because unmatched events fall through to a per-window fallback color. Activity buckets every miss as Uncategorized, so Top Categories is one lump.

    Workaround that agrees on both views: make the rule title-only, e.g. (AKARN|Elena V) and (ACG|Admin V). Caveat: that also matches those words in any other app (there is no AND across fields today).

    A real combined-app+title matcher would need Activity to use the same join Timeline already documents, plus something that can cross that join ([\s\S] / (?s) — . will not). I am not opening a PR for that while aw-webui's review queue is already full; tracking it on our side as idea 1163.

    Fixture write-up: https://github.com/ErikBjare/bob/blob/master/knowledge/research/2026-08-28-aw-webui-939-activity-timeline-category-split.md

  2. arshanskiyav commented on Aug 30, 2026

    @arshanskiyav
    Author

    Thank you for your reply.

    TG + user is just a simple example, and yes I can unify the title for TG, but for mstsc and winbox it is not possible, because both use FQDN or IP in the title.

    I'll keep an eye on it, thanks

  3. TimeToBuildBob commented on Aug 30, 2026

    @TimeToBuildBob
    Contributor

    You don't need to rewrite those titles. For mstsc/winbox the FQDN or IP already in the title is the unique token — a title-only rule (office\.example.com or 10\.0\.0\.5, no mstsc.exe.* prefix) is what both views can match today.

    Combined mstsc.exe.*host still matches nothing on either path: Activity tests app and title separately, so no field contains both.

    If mstsc and winbox show the same host string and you need them in different categories, that is field-AND (app AND title). That does not exist yet. If their title formats already differ, match the distinctive title text.

    Leaving this open for a joined app+title matcher; not opening that PR while the review queue is full.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions