Closed 200928 closed 10 months ago
Hi there! As you're new to this repo, please make sure you've used an appropriate issue template and searched for duplicates (it helps us focus on actual development!). We'd also like to suggest that you read our contribution guidelines and our code of conduct. Thanks a bunch for opening your first issue! 🙏
A similar problem has been reported by @Dion
on our Discord:
Watchers have stopped autostarting on linux startup, won't start even through a bash script that runs on WM startup. only manual starting through the terminal works. logs show the same thing for both window and afk watcher:
2023-07-15 12:20:43 [INFO ]: aw-watcher-afk started (aw_watcher_afk.afk:60) 2023-07-15 12:20:44 [INFO ]: Connection to aw-server established by aw-watcher-afk (aw_client.client:436) 2023-07-15 12:20:49 [INFO ]: afkwatcher stopped because parent process died (aw_watcher_afk.afk:80)
aw-qt fully works though
This is the solution suggested by @ErikBjare
:
Probably because it started before your tray was ready! I think someone else has reported an issue with the same problem, and solved it by adding a 5s sleep to the startup script somewhere.
Ideally, aw-qt would wait itself for x amount of time for a tray to become available, before (optionally) quitting.
Hey! There's a error in the script of start.sh, I faced the same issue:
Looking at the code of one of the aw-watchers afk or window, I found out that the function causing problem was the os.getppid() == 1
. When that condition is true, the watchers throw that exception.
When this function returns 1, this means that if the parent start.sh
terminated, then all other sub-process killed too!
When notify-send ends, the script would terminate (our parent process), then os.getppid() would return 1, which causes to fail. Interesting enough, because the server is detached from this main process, it isn't affected.
In the documentation the code is:
./aw-watcher-afk/aw-watcher-afk &
./aw-watcher-window/aw-watcher-window &
notify-send "ActivityWatch started"
To solve this issue, the start.sh should be:
./aw-watcher-afk/aw-watcher-afk &
./aw-watcher-window/aw-watcher-window &
notify-send "ActivityWatch started" # optional
./aw-server/aw-server;
The two process would start in the background, and the server would hold the main process until it's termination, which causes os.getppid()
to return 1, by that time it would ensure that all three process would end.
Fix merged in https://github.com/ActivityWatch/docs/pull/126
Uodate your start.sh
script if you are facing this issue.
Thank you for reporting!
Describe the bug
I created the
start.sh
script using the method above the URL. When I run the script in the terminal, the aw-watcher-window, aw-watcher-afk and aw-server can run normally in the first few tens of seconds. After a while the following error occurs: