Skip to content

Watcher is inaccurate #20

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
johan-bjareholt opened this issue Jun 20, 2018 · 12 comments
Open

Watcher is inaccurate #20

johan-bjareholt opened this issue Jun 20, 2018 · 12 comments
Labels

Comments

@johan-bjareholt
Copy link
Member

Just played around and abstracted aw-timeline in aw-webui so you can see browser.tab.current events there and it's clear that the activity there is not correct there rather often.

@lundibundi
Copy link

Also, it doesn't seem to detect tab-input, for example the time I was watching twitch stream was logged as afk.

@johan-bjareholt
Copy link
Member Author

@lundibundi That is likely not an bug though but a feature. The criterias for browser activity to be registered are:

  • You have to provide some input (mouse or keyboard) for aw-watcher-afk to detect if you are there or not
  • You need to focus your browser window for aw-watcher-window to detect that you are actually active in your browser
  • You need to have the specific window with your specific tab open for aw-watcher-web

So in the case of watching a twitch steam you most likely either didn't move your mouse or enter anything on your keyboard so aw-watcher-afk assumed that you were AFK or you were doing something else in some other window at the same time so aw-watcher-window registered those events instead.

In this issue specifically I mostly found that the aw-watcher-web events are sometimes too short, but the actual activity should be correct.

@lundibundi
Copy link

@johan-bjareholt But clearly if you're watching videos or twitch streams it should be logged as activity and not afk. I've checked the actual bucket of the web watcher and it seems to indeed give accurate information. So this means that the aggregator (assuming in core) should be tuned to fix this.
Maybe web watcher should provide additional flag such as video: true for the aggregator to be able to differentiate afk and videos? I should probably file this as a separate issue in the aw-core?

@ErikBjare
Copy link
Member

ErikBjare commented Jun 25, 2018

@lundibundi Yes if you've watched a Twitch stream then the web watcher will probably have logged audible: true which could be used to indicate that you were indeed not AFK despite there not being any input activity.

We've not implemented this in the data aggregation yet, but it can be done.

aw-core deals with querying/aggregation, but the actual queries that aw-core processes are specified in aw-webui. So the changes we'd need to make are in there.

@lundibundi
Copy link

@ErikBjare Hm, do I understand it correctly that basically we need to change filterAfk handling in here https://github.com/ActivityWatch/aw-webui/blob/master/src/queries.js#L38 to not exclude audible events?

But based on aw-core/aw_transform/ there is no way to do this, so I assume we need to either add mergeEvents function to add events filtered with not_afk and add a new filter of filter_keyvals(events, "audible", [true]) to append to not_afk or implement more complex filter?

@ErikBjare
Copy link
Member

ErikBjare commented Jun 26, 2018

@lundibundi Yes that would be correct, my preferred solution would be to add a period_union transform that takes two sets of events and returns the union of their timeperiods.

We'd then do something like this:

browser_audible = filter_keyvals(events, "audible", [true]);
non_afk_or_audible = period_union(non_afk, browser_audible);
window_browser = filter_period_intersect(window_browser, non_afk_or_audible);
events = filter_period_intersect(events, window_browser);

@ErikBjare
Copy link
Member

@lundibundi I've implemented the needed transform period_union here: ActivityWatch/aw-core#65

@ErikBjare
Copy link
Member

@lundibundi I've implemented something quickly that could be refined into a working solution: ActivityWatch/aw-webui#85

@lundibundi
Copy link

@ErikBjare Oh, well, I did too, lol =)
I should've said about that... Anyways feel free to checkout my version too)

Also I've run my tests on your version and there is one that behaves strangely, I'll comment in your PR.

@LakshyAAAgrawal
Copy link

Hi, Really nice project and I appreciate all the efforts very much.

I have been experimenting with ActivityWatch since yesterday, and I find the desktop server watchers(default) to be accurate, in that they log a realistic sounding number of hours for my browser usage. However, when I add up the total time spent in all domains in the web-watcher, it doesn't even come close to the default watcher's total time for browser. I believe it should add up.

My current version is: 0.4.0 of the firefox web extension installed from firefox store.

lyz-code added a commit to lyz-code/blue-book that referenced this issue Mar 19, 2021
* [The browser watcher is not very accurate](ActivityWatch/aw-watcher-web#20).
* The vim editor watcher doesn't add [git branch information](ActivityWatch/aw-watcher-vim#19).
* Syncing data between devices [is not yet supported](ActivityWatch/activitywatch#35).

perf(adr): explain how to show relationship between ADRs

Suggest a [mermaidjs](mermaidjs.md) diagram to show the state of the
project ADRs.

feat(life_automation): suggest organize to act on computer file changes

[organize](https://organize.readthedocs.io/en/latest/) looks good for
automating processes on files. Maybe it's interesting to run it with
[inotifywait](https://askubuntu.com/a/819290) instead of with a [cron
job](tfeldmann/organize#18).

feat(mkdocs): explain how to use MermaidJS diagrams

fix(vim_plugins): Forget to use abolish to insert the elipsis symbol.

Tpope said that it's not going to happen.

feat(mermaidjs): introduce the diagram library and how to make flowchart diagrams

[MermaidJS](https://mermaid-js.github.io) is a Javascript library that lets you create diagrams using text and code.

It can render the [next diagram
types](https://mermaid-js.github.io/mermaid/#/?id=diagrams-that-mermaid-can-render):

* Flowchart
* Sequence.
* Gantt
* Class
* Git graph
* Entity Relationship
* User journey

feat(peek): introduce Peek the screen recorder

[Peek](https://github.com/phw/peek) is a simple animated GIF screen recorder
with an easy to use interface.

If you try to use it with i3, you're going to have a bad time, you'd
[need to
install](https://github.com/phw/peek#on-i3-the-recording-area-is-all-black-how-can-i-record-anything)
[Compton](https://github.com/chjj/compton), and then the elements [may
not even be
clickable](https://github.com/phw/peek#why-cant-i-interact-with-the-ui-elements-inside-the-recording-area).
@niravvala
Copy link

niravvala commented May 23, 2025

Is there any update regarding this issue ?

@BelKed
Copy link
Contributor

BelKed commented May 23, 2025

It works accurately in Firefox, but Manifest V3 causes issues in Chrome

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

6 participants