ActivityWatch / aw-watcher-web

Browser watcher for ActivityWatch
Mozilla Public License 2.0
326 stars 47 forks source link

Browser activity not showing in Activity view #102

Open sbstratos79 opened 1 year ago

sbstratos79 commented 1 year ago

Raw data view has all the browser activity, but it doesn't show in the Browser tab in Activity view. My issue is very similar to #67 except for the fact that I am not using Wayland. I am using Xorg and still facing this issue.

Librewolf 109.0, EndeavourOS.

edobez commented 1 year ago

I have the same problem on Vivaldi (using Chrome extension) on Windows. Data is collected under "unknown" hostname and I can see that the bucket name misses the host name as suffix.

marcinsmialek commented 8 months ago

It can happen for many browsers - they may get recognized as different browser or there will be no matching rules in aw-webui

In case of Vivaldi, it's because Vivaldi is recognized as Chrome after they changed user agent to look like Chrome, not to be treated as second class citizen.

Reference:
https://vivaldi.com/blog/vivaldi-on-desktop-6-1/
https://help.vivaldi.com/desktop/miscellaneous/user-agent-brand-masking/
https://vivaldi.com/blog/user-agent-changes/

My current Vivaldi user agent string:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36

The browser name is read as chrome https://github.com/ActivityWatch/aw-watcher-web/blob/master/src/client.js#L27-L28

The bucket is named aw-watcher-web-chrome (without hostname), and not aw-watcher-web-vivaldi ActivityWatch tries to match web bucket events with active window events. For VIvaldi users, it'll find neither aw-watcher-web-vivaldi bucket nor chrome.exe window events.
https://github.com/ActivityWatch/aw-webui/blob/master/src/queries.ts#L284
https://github.com/ActivityWatch/aw-webui/blob/master/src/queries.ts#L303

Here's how browser extension can check if it's running on Vivaldi or Chrome
https://stackoverflow.com/questions/68659729/how-to-detect-clients-web-browser-is-vivaldi/77047611#77047611

I'm afraid that we'd need such extra check or a configuration field, so user can manually set the browser name rather than rely on the auto detection.
Manual setup looks the most promising, because it's flexible and people running niche browsers should be used to extra configuration steps.

Another solution would be to modify aw-webui web-window matching to treat Chrome-like browsers as Chrome, Firefox-like as Firefox and extend the execs list.
Or better, add config in base ActivityWatch rather than web extensions. Just now from the regular user's point of view, the browser list is hardcoded.

swapnilraj commented 2 months ago

I am using Brave and have the same issue.

This reply mentions there is a known workaround, what is it?

cnra commented 2 weeks ago

I have the same issue on Windows using Brave

BelKed commented 2 weeks ago

The problem with Brave Browser is already fixed in the latest version of aw-watcher-web, which hasn't been released yet. You can build and install the fixed version yourself by following the steps in ActivityWatch/aw-watcher-web :)