HPI icon indicating copy to clipboard operation
HPI copied to clipboard

module suggestion: ActivityWatch

Open alexriabtsev opened this issue 3 years ago • 5 comments

Is there any way to import ActivityWatch info? They have API with docs - https://docs.activitywatch.net/en/latest/rest.html

alexriabtsev avatar Jul 11 '20 21:07 alexriabtsev

I've played around with this a bit, and the docs don't really document everything that well (seems they've been in the process of migrating to rust-based core as well). had to go and poke in here, and couldn't get the delete route to work after fiddling with it for a bit. However, I was able to get event data from it, so that wouldn't be a limiting factor, at least for now.

I'm not sure how this would work with multiple buckets/generic events either. The window watcher/afk modules are standard, but how would one support loading in arbitrary data buckets?

As it says there:

The API is currently under development, and is subject to change. It will be documented in better detail when first version has been frozen.

I really did like aw-window-watcher though, so I ended up forking that to log to a CSV file instead, and have a data loader for that in my.window_watcher

Generally curious if you're using ActivityWatcher for anything else, is there some data you'd want to expose through the API?

seanbreckenridge avatar Sep 18 '20 22:09 seanbreckenridge

:wave: I wrote a basic interface for ActivityWatch.

My extractor & DAL code is here: https://github.com/hpi/activitywatch

My synchronization code is https://github.com/hpi/aw-sync-client and https://github.com/hpi/aw-sync-server

It works alright from what I've seen but there could still be fiddling needed. The way I accomplished this is using the query endpoints then synchronizing to an off-site server (not at all required tbh, I should modify the extractor to call directly), then my extractor (currently) calls out to my external AW sync server.

I did this so I can run AW on my personal Linux & WIndows along with any work computers.

madelinecameron avatar Apr 07 '21 12:04 madelinecameron

wave I wrote a basic interface for ActivityWatch.

My extractor & DAL code is here: hpi/activitywatch

My synchronization code is hpi/aw-sync-client and hpi/aw-sync-server

It works alright from what I've seen but there could still be fiddling needed. The way I accomplished this is using the query endpoints then synchronizing to an off-site server (not at all required tbh, I should modify the extractor to call directly), then my extractor (currently) calls out to my external AW sync server.

I did this so I can run AW on my personal Linux & WIndows along with any work computers.

Couldn't this be merged to HPI ?

krillin666 avatar Apr 29 '22 16:04 krillin666

It could be, but it doesnt have to be for you to use it -- if you have the client/server setup and you have this installed as editable, you can do something like what I describe here:

git clone 'https://github.com/madelinecameron/hpi' ./HPI-madeline
pip install -e ./HPI-madeline
hpi module install my.activitywatch

hpi doctor -S my.activitywatch

you can then import my.activitywatch as normal, as if it was merged into this repo (because it sort of is, HPI is a namespace package and namespace packages merge multiple folder structures into one module)

seanbreckenridge avatar Apr 29 '22 18:04 seanbreckenridge

Since Ive started using activitywatch on my android and windows machines, I also published a basic library to parse the JSON dump from activitywatch here, with the corresponding HPI file in my modules (see here for install instructions)

This only does the window titles/app names in particular with timestamps/durations, since thats what Ive always been interested in from activitywatch

seanbreckenridge avatar Dec 25 '22 22:12 seanbreckenridge