I’ve built the “ActivityWatch status” extension for Gnome Shell that shows the total time spent on the computer.
The query to fetch the spent minutes is
afk_events = query_bucket(find_bucket("aw-watcher-afk_"));
events = filter_keyvals(afk_events, "status", ["not-afk"]);
RETURN = sum_durations(events);
- basically fetching all data, and removing the afk events.
Now I noticed that videos on youtube are not tracked correctly, despite having the aw-watcher-web
extension installed in Firefox. It is sending the “audible-as-afk” tags correctly, which I confirmed by looking at the raw data.
The problem I see is that the data sent by the browser extension is not put into the afk bucket, but needs to be fetched separately.
This makes it hard for developers to obtain the correct usage time from the ActivityWatch API.
(even the official documentation only uses the afk bucket for filtering)
When another data tag like “audible” is introduced tomorrow, the same problem appears again.
What is the correct way to fetch the total usage time for today, while taking the audible flags into account?
(All while not wanting to know anything about which buckets exist on the system.)