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

qz:steal is not supported on MacOS #850

Open
tresf opened this issue Aug 12, 2021 · 0 comments
Open

qz:steal is not supported on MacOS #850

tresf opened this issue Aug 12, 2021 · 0 comments
Assignees
Labels

Comments

@tresf
Copy link
Contributor

tresf commented Aug 12, 2021

Since 2.1.4, QZ Tray offers the ability to "steal" another instance, which is helpful in multi-user environments, however for technical reasons, the qz:steal URL behavior/feature will not work on MacOS.

More information here:
https://stackoverflow.com/questions/27435606

Quoting the accepted answer:

Note that your URI handler will be called in the currently running instance of you app or will first create a new instance of your app then get called. The OpenURIEvent will contain the entire URI message you send.

This means we can capture the call to qz:steal via:

// app.setOpenURIHandler(this);

@Override
public void openURI(final com.apple.eawt.AppEvent.OpenURIEvent oue) {
    // perform action
}

... however this event is proprietary to Apple, the code won't compile on Windows or Linux, requiring some elaborate proxying.

Fortunately, Java 9 offers an API to handle this gracefully, we do this for some of our other proprietary Apple APIs, but getting both of these tested requires Custom URL registration between trial and error attempts (i.e. a full ant pkgbuild and watching the logs between each change)

Another caveat is that this technique causes QZ Tray to start asynchronously of it's startup handling, possibly causing a race between SingleInstanceChecker and PrintSocketServer, so safe, synchronized techniques must be used.

@tresf tresf added the bug label Aug 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants