Aw-watcher-afk does not detect inputs after start-up, Gnome [SOLVED]

Thanks for this great tool, Erik!

I’m running Ubuntu 20.04 GNOME with gnome-startup-applications to launch the start.sh script at start-up. See start.sh script here: Running on GNOME

So I had this issue: All my work was categorized as AFK in the WebGUI (I guess it didn’t recognize my Inputs?). I then killed the aw-watcher-afk and started it manually in verbose, and it detected my input without any issues; now, my work was also categorized as non-afk nice. My idea was that the server didn’t have enough time to start before the aw-watcher-afk, so I put a sleep of 10 seconds after the server started in the start.sh script. And now it seems to work as intended.

#!/bin/bash

cd ~/.local/opt/activitywatch         # Put your ActivityWatch install folder here

./aw-server/aw-server &
sleep 10
./aw-watcher-afk/aw-watcher-afk &
./aw-watcher-window/aw-watcher-window &                 # you can add --exclude-title here to exclude window title tracking for this session only

notify-send "ActivityWatch started"   # Optional, sends a notification when ActivityWatch is started

Hey Frans, super happy to have you as a user! I still feel like I owe your clan a great debt for showing/introducing me to the OpenTibia/C++/Linux ropes all those years ago :slight_smile:

Nice that you got it working.

Not sure what exactly went wrong here, as watchers should just retry sending events if the server is unavailable. Possible it tried to grab some Xorg resource that wasn’t (yet) available, and crashed. You should be able to see in the “Timeline” if the AFK watcher eventually reported events at all. If it did report “afk” events despite input activity, that’s be a bug worthy of investigation.

The sleep 10s workaround is completely valid though, we do the same in the aw-qt trayicon manager.