ActivityWatch / aw-watcher-window

Cross-platform window watcher (for use with ActivityWatch)
Mozilla Public License 2.0
88 stars 53 forks source link

Permissions issues on MacOS Monterey #60

Closed prplecake closed 2 years ago

prplecake commented 2 years ago

I just recently noticed I've had nearly no data logged in AW since upgrading to Monterey, aw-watcher-window's logs are full of

2021-11-20 04:18:06 [ERROR]: Exception thrown while trying to get active window: jxa error: Error: Error: ActivityWatch is not allowed assistive access.  (aw_watcher_window.main:74)

To me, that sounded like AW was missing the Accessibility permissions in System Preferences -> Security & Privacy -> Privacy -> Accessibility, but those permissions are present.

ErikBjare commented 2 years ago

Sometimes (like when updating ActivityWatch) you have to re-add the permissions (remove the old permission, add it again). I don't know why.

I think this weird permissions behavior is specific for unsigned apps (like ActivityWatch).

Worth trying, but not sure it'll fix the issue.

prplecake commented 2 years ago

That appears to have fixed the issue, I'll keep an eye on it.

Thanks!

Edit: That didn't resolve the issue. Maybe one of these days I'll find time to dig into this.

SgtPooki commented 2 years ago

I just installed activityWatch, had no data (just unknowns). image

I thought it might be permissions too, but normally apps will request permissions and pop up in the security & privacy preferences, but ActivityWatch wasn't there. I added accessibility and others manually and restarted the app, and still have no data.

totorowechat commented 2 years ago

I just installed activityWatch, had no data (just unknowns). image

I thought it might be permissions too, but normally apps will request permissions and pop up in the security & privacy preferences, but ActivityWatch wasn't there. I added accessibility and others manually and restarted the app, and still have no data.

I'm having the same problem as you.

My system information is

macOS Monterey Version 12.1
Mac mini
Chip Apple M1

ActivityWatch Version 0.11.0

Since giving ActivityWatch Accessibility permission doesn't work, my temporary solution is to give Terminal permission of Accessibility and then run /Applications/ActivityWatch.app/Contents/MacOS/aw-qt from terminal.

The cause of this error might be if you start ActivityWatch from the mac's launchpad aw-watch-window doesn't have permission for some reason, so the log shows

[ERROR]: Exception thrown while trying to get active window: jxa error: Error: Error: An error occurred. (aw_watcher_window.main:74)

And on my computer, others like aw-watch-afk is working fine.

bob-ortiz commented 2 years ago

@SgtPooki I have the same problem as you, my info is: macOS Mojave 10.14.1 (Build 18B75) ActivityWatch Version v0.11.0

prplecake commented 2 years ago

Sometimes (like when updating ActivityWatch) you have to re-add the permissions (remove the old permission, add it again). I don't know why.

I think this weird permissions behavior is specific for unsigned apps (like ActivityWatch).

Worth trying, but not sure it'll fix the issue.

@ErikBjare I think this actually is the resolution... removing and adding the entry for ActivityWatch (actually pressing the - button, unchecking it isn't enough. I think that might be what I did last time.) It's also possible this must be redone after OS updates. I'll check after the next time I have to update.

For everyone else, other than using the dashboard to check if you're experiencing the issue, I found checking the aw-watcher-window log file came in handy. If you see the following error: [ERROR]: Exception thrown while trying to get active window: jxa error: Error: Error: ActivityWatch is not allowed assistive access. (aw_watcher_window.main:74), What Erik had suggested.

If that doesn't resolve it, the aw-watcher-window log should shed light on what the issue is if it's not assistive access.

may commented 2 years ago

I was not able to find a consistent solution to this other than running via the command line, but that's doable.

jensarbogast commented 2 years ago

I am having the same issue. Although I added AW to the list in System Settings > Privacy > Accessibility, AW cannot log window titles. Starting it via Terminal results in Terminal asking for various permissions and then everything works well. It is a doable workaround but could maybe be fixed nonetheless.

ErikBjare commented 2 years ago

The original issue here was due to ActivityWatch not being codesigned, but now it is.

Related permissions issues have a fix in the works, see here: https://github.com/ActivityWatch/activitywatch/issues/334#issuecomment-1258166391

Closing.