fix: multiple goose instances running at once (#2234)
This commit is contained in:
+17
-15
@@ -39,13 +39,15 @@ if (started) app.quit();
|
|||||||
|
|
||||||
app.setAsDefaultProtocolClient('goose');
|
app.setAsDefaultProtocolClient('goose');
|
||||||
|
|
||||||
const gotTheLock = app.requestSingleInstanceLock();
|
// Only apply single instance lock on Windows where it's needed for deep links
|
||||||
|
let gotTheLock = true;
|
||||||
|
if (process.platform === 'win32') {
|
||||||
|
gotTheLock = app.requestSingleInstanceLock();
|
||||||
|
|
||||||
if (!gotTheLock) {
|
if (!gotTheLock) {
|
||||||
app.quit();
|
app.quit();
|
||||||
} else {
|
} else {
|
||||||
app.on('second-instance', (event, commandLine) => {
|
app.on('second-instance', (event, commandLine) => {
|
||||||
if (process.platform === 'win32') {
|
|
||||||
const protocolUrl = commandLine.find((arg) => arg.startsWith('goose://'));
|
const protocolUrl = commandLine.find((arg) => arg.startsWith('goose://'));
|
||||||
if (protocolUrl) {
|
if (protocolUrl) {
|
||||||
const parsedUrl = new URL(protocolUrl);
|
const parsedUrl = new URL(protocolUrl);
|
||||||
@@ -84,15 +86,15 @@ if (!gotTheLock) {
|
|||||||
}
|
}
|
||||||
mainWindow.focus();
|
mainWindow.focus();
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
});
|
}
|
||||||
if (process.platform === 'win32') {
|
|
||||||
const protocolUrl = process.argv.find((arg) => arg.startsWith('goose://'));
|
// Handle protocol URLs on Windows startup
|
||||||
if (protocolUrl) {
|
const protocolUrl = process.argv.find((arg) => arg.startsWith('goose://'));
|
||||||
app.whenReady().then(() => {
|
if (protocolUrl) {
|
||||||
handleProtocolUrl(protocolUrl);
|
app.whenReady().then(() => {
|
||||||
});
|
handleProtocolUrl(protocolUrl);
|
||||||
}
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user