diff --git a/resources/js/electron-plugin/dist/index.js b/resources/js/electron-plugin/dist/index.js index 568eb7da..a85a2cd5 100644 --- a/resources/js/electron-plugin/dist/index.js +++ b/resources/js/electron-plugin/dist/index.js @@ -23,6 +23,7 @@ class NativePHP { constructor() { this.processes = []; this.schedulerInterval = undefined; + this.mainWindow = null; } bootstrap(app, icon, phpBinary, cert) { initialize(); @@ -66,6 +67,16 @@ class NativePHP { } event.preventDefault(); }); + 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()); + }); + } } bootstrapApp(app) { return __awaiter(this, void 0, void 0, function* () { @@ -124,6 +135,13 @@ class NativePHP { else { app.setAsDefaultProtocolClient(deepLinkProtocol); } + if (process.platform === 'win32') { + const gotTheLock = app.requestSingleInstanceLock(); + if (!gotTheLock) { + app.quit(); + return; + } + } } } startAutoUpdater(config) { diff --git a/resources/js/electron-plugin/dist/server/api/menuBar.js b/resources/js/electron-plugin/dist/server/api/menuBar.js index 2cfe44f9..73df2c38 100644 --- a/resources/js/electron-plugin/dist/server/api/menuBar.js +++ b/resources/js/electron-plugin/dist/server/api/menuBar.js @@ -35,6 +35,11 @@ router.post("/hide", (req, res) => { res.sendStatus(200); state.activeMenuBar.hideWindow(); }); +router.post("/resize", (req, res) => { + res.sendStatus(200); + const { width, height } = req.body; + state.activeMenuBar.window.setSize(width, height); +}); router.post("/create", (req, res) => { res.sendStatus(200); let shouldSendCreatedEvent = true; diff --git a/resources/js/electron-plugin/src/server/api/menuBar.ts b/resources/js/electron-plugin/src/server/api/menuBar.ts index 52260d25..2984bbec 100644 --- a/resources/js/electron-plugin/src/server/api/menuBar.ts +++ b/resources/js/electron-plugin/src/server/api/menuBar.ts @@ -53,6 +53,14 @@ router.post("/hide", (req, res) => { state.activeMenuBar.hideWindow(); }); +router.post("/resize", (req, res) => { + res.sendStatus(200); + + const { width, height } = req.body; + + state.activeMenuBar.window.setSize(width, height); +}); + router.post("/create", (req, res) => { res.sendStatus(200);