ActivityWatch and osquery
I’ve been recommending ActivityWatch to friends and co-workers. Its a open-source time tracking tool, with a lot of hard work put into it. Privacy is a major focus, see the Feature Comparison row for the incumbent RescueTime.
The goal of ActivityWatch is simple: Enable the collection of as much valuable lifedata as possible without compromising user privacy.
I was curious what it would take to integrate into osquery. Hopeful that with this integration, we could try to JOIN “lifedata” with system events.
Happily Python bindings are available to osquery’s C++ extension framework. It took a couple of attempts, notably there is a Python3 incompatibility, but I was able to get the base extension up and running on my osquery instance.
The next step was to bring in the ActivityWatch data — the author’s RESTful API and Swagger service made this a walk in the park. For this post, I’ll just grab the WindowWatcher events, but you could export even more.
Putting it all together, here we have a osquery extension that requests and exposes Current Window events from ActivityWatch.
With this integration, we can now ask questions like:
- How does System Utilization effect User’s focus
- What Systems Events occured just before a Window change
- How does a Kernel Panic affect me
I would hope knowning these answers would unlock a new, superhuman level of staying focused — maybe not.