Running at boot, a systemd service file

In the git repo I see some service files for systemd. But in the downloaded package there aren’t any.

What’s the “proper” way for a user to install activitywatcher as a service?

The .service file was used when aw-qt didn’t exist so simply autostarting aw-qt when you start your desktop is currently the recommended way to do it.

However if you would still like to run it as a service, it’s possible. Previously we ran aw-server in a service file (always, no matter if your desktop was running or not) and then autostarting aw-wathcer-afk and aw-watcher-window when starting your desktop session. The issue with this however is that if any of the watchers crashes you will not be notified and it will not restart, however that should not happen anyway so it hopefully shouldn’t be an issue. It would be cool if systemd could be aware when a desktop session is started and then start the watchers, but as far as I’m aware that is not possible but I might be wrong.

Makes sense! It would be nice then to provide a .desktop file in the package so that it can be easily added with a DE’s autostart tool (such as gnome’s tweaktool).

The user will have to edit the file with the correct path to where they extracted the tarball, and manually place the desktop file in ~/.local/share/applications, but that’s ok for this early stage I think.

There is actually a .desktop file available here: https://github.com/ActivityWatch/aw-qt/blob/master/resources/aw-qt.desktop

You just need to modify the Exec=aw-qt line to point to the location of the aw-qt executable. We intend to automatically move it to the ~/.config/autostart folder in the future on first run (after asking the user), which is essentially what your DE’s autostart settings are doing. This will probably work well on the major DE’s, but might not on minimalistic DE/WM’s such as i3/dwm/xmonad/awesome (we’ll have to look into that).

You might also be interested in the following issue.