Is it possible to combine Linux/KDE activitiy-usage with the activity-logging of AW?

I used ActivityWatch for two days now (Manjaro Linux, KDE), so I am quite new to it. Very nice application, thank you very much!

I already use different KDE activities for working on different topics/projects. For a new project I usually create a new KDE activity.

Of course, I would love to track the time automatically, that I spent on these different KDE-activities. So I am wondering how to proceed:

Should create a new bucket and use the “aw-watcher-cli” (e.g. ‘add-activity.py -a “Project A” kde-bucket’ ) together with self defined shortcuts in KDE to trigger the ActivityWatch?

Or is it more common, to set up a service, that creates the bucket (if not exist) and and assigns the consumed time on the KDE-activities automatically to the AW-activities?

I know a little bit about shell scripting and the usual tools under linux. But since I am not really a programmer, a helping hand would be welcome :slight_smile:

Kind regards,
Paul

1 Like

Welcome Paul!

The first thing you would have to figure out would be to find an API in KDE that can tell your application what the current Activity is, then you can use that for your watcher.

The most common way to code watchers is with the official aw-client library for the python programming language (which is an quite easy to learn programming language) which is what I would recommend and follow the tutorial in the official documentation https://docs.activitywatch.net/en/latest/writing-watchers.html. There are also libraries for JavaScript and Rust, but I think that python would make more sense for your use-case.

I have actually never seen the “aw-watcher-cli” program before and that was completely new to me, not sure if that’s the best way forward though as it does not seem to be actively maintained or very widely used.

Hello Johan,

Thank you for your kind reply and your pov regarding aw-watcher-cli.

I just played around and got some interesting results. I post a follow-up question soon, but some things to check beforehand.

Ok, I wrote a small piece of code to do it using the “kactivities” command.
It is one second heartbeats but you can increase or decrease the time intervals.
The heartbeats are automatically merged by the server if needed!

here is the code: https://github.com/nokhbeh100/kactivities-watcher

2 Likes