aw-watcher-ask

An ActivityWatch watcher to pose questions to the user and record her answers.

This watcher uses Zenity to present dialog boxes to the user, and stores her answers in a locally running instance of ActivityWatch. This can be useful to poll all sorts of information on a periodical or random basis. The inspiration comes from the experience sampling method (ESM) used in psychological studies, as well as from the quantified self movement.

Install

Using pip/pipx

Create a virtual environment, activate it and run:

$ python3 -m pip install git+https://github.com/bcbernardo/aw-watcher-ask.git
Collecting git+https://github.com/bcbernardo/aw-watcher-ask.git
... ...
Installing collected packages: aw-watcher-ask
Successfully installed aw-watcher-ask-0.1.0

Alternatively, you may use pipx to abstract away the creation of the virtual environment, and make sure the package is globally available:

$ pipx install git+https://github.com/bcbernardo/aw-watcher-ask.git
  installed package aw-watcher-ask 0.1.0, Python 3.9.6
  These apps are now globally available
    - aw-watcher-ask
done! ✨ ? ✨

From source

To install the watcher, clone the repository to your local filesystem and
install it with poetry:

$ git clone https://github.com/bcbernardo/aw-watcher-ask.git
$ cd aw-watcher-ask
$ poetry install
... ...
Installing the current project: aw-watcher-ask (0.1.0)
$ poetry shell  # alternatively, add `poetry run` before every command in the examples below

Usage

Before you start using aw-watcher-input, make sure you have ActivityWatch installed and running.

CLI

The following command will show the dialog box below each hour at 00 minutes
and 00 seconds, wait up to 120 seconds for the user's response, and save it to
a bucket in the local ActivityWatcher instance.

$ aw-watcher-ask run --question-id "happiness.level" --question-type="question" --title="My happiness level" --text="Are you feeling happy right now?" --timeout=120 --schedule "0 */1 * * * 0"
... ...

example_dialog

Check aw-watcher-ask run --help to see all required and optional control parameters.

The --question-id is used to identify this particular question in the ActivityWatcher a aw-watcher-input bucket, and is therefore mandatory.

The question-type parameters is also required and should be one of Zenity's supported dialog types (complex types such as forms, file-selection and list have not been implemented yet). All options supported by these dialog types are accepted by aw-watcher-ask run as extra parameters, and passed unaltered to Zenity under the hood.

Accessing the data

All data gathered is stored under aw-watcher-ask_localhost.localdomain bucket (or test-aw-watcher-ask_localhost.localdomain, when running with the --testing flag) in the local ActivityWatch endpoint. Check ActivityWatch REST API documentation to learn how to get the stored events programatically, so that you can apply some custom analysis.

Security

As other ActivityWatcher watchers, aw-watcher-ask communicates solely with the locally running AW server instance. All data collected is stored in your machine.

Limitations and Roadmap

aw-watcher-ask is in a very early development stage. Expect bugs and strange behaviors when using it.

This package uses zenity utility, which must be installed in the system and globally accessible through the command line. Zenity comes pre-installed with most Linux installations, and can be installed from all major package repositories (apt, dnf, pacman, brew etc.).

Porting Zenity to Windows is not trivial. If you use Windows, you may give @ncruces' Go port a shot, as it is supposed to be cross-platform. It have not been tested with aw-watcher-ask though, and may therefore behave unexpectedly.

aw-watcher-ask does not currently have a way of storing the questions made, and scheduling them every time the system restarts. We want to implement this eventually, but for now you should wrap all questions you want to schedule in a (shell) script and configure your system to execute it at every startup.

Maintainers

GitHub

https://github.com/bcbernardo/aw-watcher-ask