mirror of
https://github.com/aljazceru/goose.git
synced 2026-01-02 22:14:26 +01:00
fix: multiple goose instances running at once (#2234)
This commit is contained in:
@@ -39,13 +39,15 @@ if (started) app.quit();
|
||||
|
||||
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) {
|
||||
app.quit();
|
||||
} else {
|
||||
app.on('second-instance', (event, commandLine) => {
|
||||
if (process.platform === 'win32') {
|
||||
if (!gotTheLock) {
|
||||
app.quit();
|
||||
} else {
|
||||
app.on('second-instance', (event, commandLine) => {
|
||||
const protocolUrl = commandLine.find((arg) => arg.startsWith('goose://'));
|
||||
if (protocolUrl) {
|
||||
const parsedUrl = new URL(protocolUrl);
|
||||
@@ -84,15 +86,15 @@ if (!gotTheLock) {
|
||||
}
|
||||
mainWindow.focus();
|
||||
}
|
||||
}
|
||||
});
|
||||
if (process.platform === 'win32') {
|
||||
const protocolUrl = process.argv.find((arg) => arg.startsWith('goose://'));
|
||||
if (protocolUrl) {
|
||||
app.whenReady().then(() => {
|
||||
handleProtocolUrl(protocolUrl);
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Handle protocol URLs on Windows startup
|
||||
const protocolUrl = process.argv.find((arg) => arg.startsWith('goose://'));
|
||||
if (protocolUrl) {
|
||||
app.whenReady().then(() => {
|
||||
handleProtocolUrl(protocolUrl);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user