Activitywatch: macOS .app permission issues

Created on 15 Mar 2020  路  6Comments  路  Source: ActivityWatch/activitywatch

The latest (bdf4fa1 ) build nor any earlier macos build doesn't get window titles. ~The .App fails to ask permissions for aw-watcher-window, or something of the sort (since it is a subprocess).~ Actually I probably just had given permissions to an ActivityWatch.app with a different code signature.

As became apparent here https://github.com/ActivityWatch/activitywatch/issues/334#issuecomment-605647625 the cause of suddenly missing permissions can be a system or app update. For some reason macOS doesn't seem to always connect the given accessibility permissions to the new activitywatch .app. Could this be related to not having a code signature / having a non-notarized one?

There are no errors in aw-watcher-window's logs, but some macos warnings about missing files and or signatures are in the system console. (https://gist.github.com/xylix/5a85fde8f69f176402b524a16b9692fd )

Screenshot 2020-03-15 at 19 17 05

A workaround is running the .app from the command line and giving your terminal accessibility permissions. There might also be other workarounds, will document them here.

macos bug

All 6 comments

It seems like there's an API to detect if the current application is allowed to use the Accessibility services needed. On some Googling it appears that other apps like Dropbox use this to ask user to give the permission (by pointing them to the permissions page): https://stackoverflow.com/questions/53616609/how-to-ask-for-accessibility-permission-in-macos

I haven't tested this snipped, but it should work:

from ApplicationServices import AXIsProcessTrusted
print("Process have accessibility permission: ", AXIsProcessTrusted())

Not sure how to make the process inherit accessibility permissions from the main .app though (edit: this doesn't seem to be a problem, from the update to your main post), but at least that snipped makes it possible to check that accessibility permissions is indeed the problem.

Hm actually on my device I fixed it just by manually removing the accessibility permions from ActivityWatch.app and then re-adding them. This issue was probably due to me having given the permissions to an old, unsigned activitywatch.app and the signature of the old aw.app not matching with the new signed one or so.

So I am pretty sure just adding the ask for accessibility permissions to the main.app will fix the problem, and users should not have seen this problem if they haven't been using ActivityWatch.app on Catalina before the signed versions came along.

Then maybe we can just close this issue? Hopefully, people who stumble into this problem will just find this issue, and then they'll know what to do.

Edit: Just realized we still need to tell users to add the permission.

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

I have started to experience the same issue, but when I try what @xylix said, about disabling and re-enabling the permissions.

Is there any more to it? Do I need to do anything more than just disabling and re-enabling the permissions?

So when the time passed my "Start of day", it started to show the Window names again. So the re-enabling worked! 馃槃

Was this page helpful?
0 / 5 - 0 ratings

Related issues

alexriabtsev picture alexriabtsev  路  4Comments

ankushdas9 picture ankushdas9  路  8Comments

TheOrigins picture TheOrigins  路  6Comments

toXel picture toXel  路  5Comments

iamsoorena picture iamsoorena  路  10Comments