Fix deep links and double clicks on second instance (#5865)

* Deep links or double clicks don't work on second instance on Windows
Fixes #5864

* A snapshot a day keeps the bugs away! 📷🐛

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
This commit is contained in:
Pierre Jacquier
2025-03-18 15:17:21 -04:00
committed by GitHub
parent 86beb6ebf1
commit 44be072d04
3 changed files with 3 additions and 5 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 55 KiB

After

Width:  |  Height:  |  Size: 55 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 68 KiB

After

Width:  |  Height:  |  Size: 68 KiB

View File

@ -58,6 +58,7 @@ console.log('Environment vars', process.env)
console.log('Parsed CLI args', args) console.log('Parsed CLI args', args)
/// Register our application to handle all "zoo-studio:" protocols. /// Register our application to handle all "zoo-studio:" protocols.
const singleInstanceLock = app.requestSingleInstanceLock()
if (process.defaultApp) { if (process.defaultApp) {
if (process.argv.length >= 2) { if (process.argv.length >= 2) {
app.setAsDefaultProtocolClient(ZOO_STUDIO_PROTOCOL, process.execPath, [ app.setAsDefaultProtocolClient(ZOO_STUDIO_PROTOCOL, process.execPath, [
@ -72,11 +73,8 @@ if (process.defaultApp) {
// Must be done before ready event. // Must be done before ready event.
// Checking against this lock is needed for Windows and Linux, see // Checking against this lock is needed for Windows and Linux, see
// https://www.electronjs.org/docs/latest/tutorial/launch-app-from-url-in-another-app#windows-and-linux-code // https://www.electronjs.org/docs/latest/tutorial/launch-app-from-url-in-another-app#windows-and-linux-code
if (!IS_PLAYWRIGHT) { if (!singleInstanceLock && !IS_PLAYWRIGHT) {
const singleInstanceLock = app.requestSingleInstanceLock() app.quit()
if (!singleInstanceLock) {
app.quit()
}
} else { } else {
registerStartupListeners() registerStartupListeners()
} }