ActivityWatch / activitywatch

The best free and open-source automated time tracker. Cross-platform, extensible, privacy-focused.
https://activitywatch.net/
Mozilla Public License 2.0
12.24k stars 553 forks source link

permanently disable afk and window watchers #272

Closed vesper8 closed 5 years ago

vesper8 commented 5 years ago

I would like to permanently disable the built-in afk and window watcher

basically I am only interested in using ActivityWatch to keep track of my vscode activity. I've already installed the vscode plugin (https://github.com/ActivityWatch/aw-watcher-vscode)

I know I can click the tray icon and uncheck the afk and window watcher modules

but every time I restart ActivityWatch they are turned back on. How do I prevent this?

Thank you!

ErikBjare commented 5 years ago

Which OS?

aw-qt takes a commandline argument --autostart=... (or something similar, check aw-qt --help) that you can set to just aw-server which will make it only start the server.

vesper8 commented 5 years ago

I'm on OSX

Thank you.. that seems to work as far as launching aw-qt without the afk and window watcher enabled

however this leads me to another problem. Now when I start aw-qt I can't access the Activity tab anymore, where my vscode watcher information was previously shown

it just says 'No activity reports available, make sure you have both an afk and window watcher running'

There doesn't seem to be a dedicated "watcher" for vscode either. After installing the extension in vscode.. it just worked

Does that mean that the vscode watcher is somehow an extension of the window watcher and it can't function unless the window watcher is also enabled?

I really only want aw-qt to be tracking vscode, not tracking all my other windows. Is there a way to achieve this?

Thanks for your attention and help in this matter!

johan-bjareholt commented 5 years ago

@vesper8 Good point, that's actually a flaw in the webui. The webui expects there to be both a window and afk bucket and will otherwise not show it as an available host. This is obviously a bad assumption as you just proved to us.

A quick workaround would be to start aw-watcher-afk and aw-watcher-window once so the buckets are created and then never start them again.

vesper8 commented 5 years ago

hrm ok.. well hopefully something that will be accounted for in an upcoming release then : )

ok so I enabled them both for a few seconds and disabled them again. That created the buckets and indeed that's given me access to the Activity page. I tested to make sure the vscode tracking is still working with the afk/window watchers and indeed it does! so all good now :)

now to see if I have the time and motivation for my next endeavour.. to use the rest api from aw-qt and the data from the vscode watcher to replicate wakatime's dashboard and cool-looking realtime graphs and charts!

johan-bjareholt commented 5 years ago

@vesper8 If you get some nice plots, feel free to share with us. We are aware that our activity visualization is sub-par and would love some inspiration or even a reference implementation!

vesper8 commented 5 years ago

@johan-bjareholt sure once I get it to a polished state I'm happy to share. I don't know how usable it will be for you guys however.

Here's what I've done so far:

I set up a new laravel project to fetch all vscode-related events from AW's rest api and log them in a mysql database. Then I've set up my own api endpoint that transforms that data. I basically had a look at how the data is transformed in Wakatime and have mimicked it 100%

I then set up a Vue front-end that gets the data from my Laravel API and I'm now working on building Wakatime's Dashboard with the data and C3 charts. Since this is first and foremost for personal use I am just re-using their own code since their graphs are somewhat complex and I have limited understanding of how to create complex graphs with C3.

I'm having to take a little break from this endeavour after spending the last 2 days on it, but I will come back to it soon.

I sure am excited about it though =D

johan-bjareholt commented 5 years ago

I set up a new laravel project to fetch all vscode-related events from AW's rest api and log them in a mysql database. Then I've set up my own api endpoint that transforms that data. I basically had a look at how the data is transformed in Wakatime and have mimicked it 100%

I then set up a Vue front-end that gets the data from my Laravel API and I'm now working on building Wakatime's Dashboard with the data and C3 charts. Since this is first and foremost for personal use I am just re-using their own code since their graphs are somewhat complex and I have limited understanding of how to create complex graphs with C3.

Sorry for being blunt, but please avoid reinventing the wheel

Pretty much the only difference between your app and ours from what you stated is that you are using Lavarel while we are using python+flask.

Why not just use what ActivityWatch already provides? If it doesn't fit your use-case for some reason we'd love to get suggestions on how to provide it and we would happily take PRs and in some cases we'd even be happy to extend something for you.

This project is open source because we don't want to avoid just this, reinventing the wheel and try to work on a project together with a community to achieve bigger goals.

vesper8 commented 5 years ago

appreciate very much what you're doing here and don't mind the bluntness : )

honestly I went this route because Laravel/Vue is what I'm comfortable with. I build a lot of rest apis w/ data transformers on Laravel, and front-ends with vue-cli and it's just what I love to use. I barely know Python and never heard of Flask.

Also had no idea the project already made use of Vue, I can see that now after checking out aw-webui. And I tried to find out what database you were using so I didn't have to go the mysql way but in the end it seemed that you use Peewee as a database which I wasn't familiar with.

Could you let me know where the SQLite database is located on OSX? I will definitely opt to connect directly to that. But I do like having the data in mysql as I'm sure it won't accidentally get flushed.

I just really like the way the activity is displayed on Wakatime (stacks and spline graph) so my goal was to end up with a free version of that. Like I said once I get my graphs in a more polished state I'll be more than happy to share that code.

My only suggestions right now is to make it clearer which database is used and how to connect to it (where its stored). An option to use mysql instead of sqlite would be very welcome to.

johan-bjareholt commented 5 years ago

Alright, fair enough :) I mostly wanted to know why you did it the way you did and it seems to be a mix of lack of knowledge about AcitvityWatch and wanting to use technologies you are used to.

Could you let me know where the SQLite database is located on OSX? I will definitely opt to connect directly to that. But I do like having the data in mysql as I'm sure it won't accidentally get flushed.

We decide data/cache/config directories with the appdirs library (which uses the standard directory on every platform). If I remember correctly on macOS it should be in "Application Support/activitywatch/aw-server".

I just really like the way the activity is displayed on Wakatime (stacks and spline graph) so my goal was to end up with a free version of that. Like I said once I get my graphs in a more polished state I'll be more than happy to share that code.

That sounds awesome :)

An option to use mysql instead of sqlite would be very welcome to.

Previously we have supported multiple databases (mongodb, peewee+sqlite, memorystorage for testing) but we have decided that supporting anything else than SQLite seems like a waste of time. Very few care about installing mongodb/mysql to be able to use ActivityWatch and just want it to work out-of-the-box and SQLite has all the features and performance we need. We just recently merged a raw SQLite datastore which is a functioning but WIP and has lots of performance optimizations and which will hopefully in the future be the only datastore. We will still keep the code modular though in case we ever change our mind.

ChildishGiant commented 5 years ago

I'm attempting to do the same on windows but .\aw-qt.exe --help isn't returning anything.