ActivityWatch / aw-watcher-window

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

[macOS] Exception thrown while trying to get active window: error compiling jxa script #58

Closed simzou closed 3 years ago

simzou commented 3 years ago

On a fresh installation of ActivityWatch on Mac, the aw-watcher-window application failed to work, resulting in all applications reporting as "unknown".

image

Inspecting the logs, this was the error message, logged approximately every second:

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

When I pasted printAppStatus.jxa into the script editor to debug, the error message reported

Error on line 1: SyntaxError: Invalid character: '#'

Opening the package contents and deleting line 1 from printAppStatus.jxa then solved the problem for me.

I didn't see this error come up in any google searches or existing issues, which was odd to me because the first thing I tried was to remove and reinstall the app a couple times but this bug was consistent on a fresh install on my machine (running Mojave 10.14.6). It's a simple code fix, as seen above, but not seeing the bug reported elsewhere, I wasn't sure if it was affecting anybody else's machine. It seems like it should have, given that the bug was a syntax error in the jxa file.

ErikBjare commented 3 years ago

Wow, that explains a lot.

We've been having loads of issues on macOS, and this might be one of the many causes. I'll make a PR asap.

ErikBjare commented 3 years ago

I hopefully fixed this in https://github.com/ActivityWatch/aw-watcher-window/pull/59. Might take a while until it lands in a release, but in the meantime you can try a nightly build (see https://github.com/ActivityWatch/activitywatch/issues/507) as soon as the latest CI run completes.

simzou commented 3 years ago

Thanks so much!