Configuration location portability


#1

After downloading activitywatch, I run the respective executables/binaries and due to the fact that activitywatch uses https://pypi.org/project/appdirs/, config files are automatically created in the user directory.

I would prefer to either be able to define that path myself (like aw-watcher-windows -c /var/opt/config/) or have that path being created / used within the activitywatch folder. Activitywatch would be portable this way, at least on windows.

Is there a possibility to do this out of the box or would I have to compile activitywatch myself?


#2

I’m not 100% sure how the appdirs library is implemented, but I know that it’s based on the XDG standard on Linux so maybe it’s overridable with the environment variable XDG_CONFIG_HOME if the implementation of appdirs has support for that. Start with trying that out as that would be a simple solution.


#3

Yes, that’s what’s also in the documentation (for Linux), however, I require this to work on windows, so that solution wouldn’t apply.


#4

Oh sorry, didn’t read your post thoroughly enough.

Hm, yeah in that case it’s a bit more cumbersome to solve. A parameter for every watcher would solve it but it would also be duplicate code across all watchers which is undesirable. We also have one config for aw-client, one for the watcher itself and then a cache file for queued events which should preferably all be configurable to make the watchers completely portable which I could see people could have a use-case for.

I also took a look at the appdirs windows code and see that it uses some CSIDL folder variable, whether this is modifiable or not though I don’t know as I don’t know much about Windows APIs.

But to your original question, if it’s not possible to set the CSIDL variable then it’s not possible to configure that with the packaged version of ActivityWatch currently and you’d have to run it from source and modify the code.