Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions resources/js/electron-plugin/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ const { autoUpdater } = electronUpdater;
class NativePHP {
processes = [];
schedulerInterval = undefined;
mainWindow = null;

public bootstrap(
app: CrossProcessExports.App,
Expand Down Expand Up @@ -88,6 +89,17 @@ class NativePHP {

event.preventDefault();
});

// Handle deep linking for Windows
if (process.platform === 'win32') {
app.on('second-instance', (event, commandLine, workingDirectory) => {
if (this.mainWindow) {
if (this.mainWindow.isMinimized()) this.mainWindow.restore();
this.mainWindow.focus();
}
this.handleDeepLink(commandLine.pop());
});
}
}

private async bootstrapApp(app: Electron.CrossProcessExports.App) {
Expand Down Expand Up @@ -161,6 +173,15 @@ class NativePHP {
} else {
app.setAsDefaultProtocolClient(deepLinkProtocol);
}


if (process.platform === 'win32') {
const gotTheLock = app.requestSingleInstanceLock();
if (!gotTheLock) {
app.quit();
return;
}
}
}
}

Expand Down