Setting up ActivityWatch Watcher-ask on Windows

Objective

Set up a desktop notification programme that prompts self-reflective questions. The answers will be logged into ActivityWatch for later analysis with other data to identify how my internal state (e.g. peace of mind) is linked to my computer activities.

Methods

System information

  • Windows 10
  • Powershell
  • ActivityWatch 0.11.0

Software requirement

Install aw-watcher-ask

First, create a new python virtual environment (here I used conda) with python installed. Then, follow the instructions on the aw-watcher-ask repoistory and install the package and relevant dependencies with pip: python -m pip install git+https://github.com/bcbernardo/aw-watcher-ask.git.

Caveats

Here all python libraries required to call the package has been installed, but it still needs the interface, zenity, to start desktop notification. When zenity is not installed, the python library pyzenity will attempt to install the package by provoking sudo rights (not a good practice). This will require sudo rights on a UNIX based computer, and will prompt an error message because sudo is not available in Powershell. To verify this error:

> python
Python 3.10.0 | packaged by conda-forge | (default, Nov 10 2021, 13:20:59) [MSC v.1916 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import zenity
>>> zenity.show()
'sudo' is not recognized as an internal or external command,
operable program or batch file.
False

Set up Zenity

First, download the latest release of go port zenity from here. Then, add the directory containing the .exe file to Powershell path by $env:Path+= ";C:\path_to_exe" (customize here). This will tell pyzenity where zenity is so it will not attempt to install zenity on its own.

Conclusion

All done! Now you should be able to run aw-watcher-ask with commands specified on this page.

Acknowledgement

Thanks to Bernardo and Nuno’s help in building the software and troubleshooting the setup.

Other (unsuccessful) attempts

Windows Subsystem Linux 2

Although the go port zenity supports WSL, the aw-watcher-ask installed in the WSL2 environment will not be able to communicate with the localhost port that ActivityWatch runs on. One needs to open the Windows port and make WSL2 recognises the Windows port. I did not follow through with this path because I am not confident whether it will work eventually (because the watcher and ActivityWatch) will run in different systems. It might be more straightforward in WSL1 because it shares the same localhost with Windows.

Avatar
Tim

Personalizing medicine

Related