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

Using app name for AppleScript url access breaks when users change the name of their browser app #117

Closed
wrgoto opened this issue Jun 11, 2021 · 2 comments · Fixed by #118

Comments

@wrgoto
Copy link
Contributor

wrgoto commented Jun 11, 2021

We're currently using AppleScript to get the URL from apps by referencing the app name in the script. I've noticed that changing the name of the browser causes this functionality to break. As an example, if I rename 'Google Chrome' to just 'Chrome' on my mac, it'll break active-win's ability to grab the URL from Chrome.

I think there are a couple of ways we can tackle this issue. The first would be to use the bundle ids of the application to reference the app, though I'm not entirely sure AppleScript can do this.

The other would be to take a functional approach to try to grab the URL of the app regardless of what app it is. If it fails, then catch the failure and return null. This would be nice as it would work out of the box with all browsers (as long as they support the same paradigms of providing the URL) and avoid having to add each one individually.

@sindresorhus
Copy link
Owner

Yeah, we should use bundle identifiers instead.

@sindresorhus
Copy link
Owner

The other would be to take a functional approach to try to grab the URL of the app regardless of what app it is.

AppleScript comes with some overhead, so I don't think we should execute it regardless.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants