Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

macOS .app permission issues #376

Closed
xylix opened this issue Mar 15, 2020 · 7 comments
Closed

macOS .app permission issues #376

xylix opened this issue Mar 15, 2020 · 7 comments

Comments

@xylix
Copy link
Contributor

xylix commented Mar 15, 2020

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 #334 (comment) 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.

@ErikBjare
Copy link
Member

ErikBjare commented Mar 15, 2020

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.

@xylix
Copy link
Contributor Author

xylix commented Mar 15, 2020

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.

@ErikBjare
Copy link
Member

ErikBjare commented Mar 15, 2020

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.

@xylix xylix changed the title macOS .app missing window titles macOS .app unclear permission requirements Mar 18, 2020
@xylix xylix added this to the v0.10 milestone Mar 18, 2020
@xylix xylix self-assigned this Mar 18, 2020
@xylix xylix changed the title macOS .app unclear permission requirements macOS .app permission issues Mar 31, 2020
@stale
Copy link

stale bot commented Sep 27, 2020

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.

@stale stale bot added the stale label Sep 27, 2020
@timharek
Copy link

timharek commented Oct 9, 2020

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?

@timharek
Copy link

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

@stale
Copy link

stale bot commented May 15, 2021

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.

@stale stale bot added the stale label May 15, 2021
@stale stale bot closed this as completed Jun 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants