From 8c3ca82a033803b3c95b81810f3549acc8516675 Mon Sep 17 00:00:00 2001 From: Yuzu Date: Tue, 16 Jun 2026 01:03:02 +0700 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20feat:=20Single=20instance=20applica?= =?UTF-8?q?tion=20behavior?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/index.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/main/index.ts b/src/main/index.ts index 446f8ee..094aa60 100644 --- a/src/main/index.ts +++ b/src/main/index.ts @@ -70,6 +70,12 @@ let mainWindow: BrowserWindow | null = null let tray: Tray | null = null let quitting = false +const gotSingleInstanceLock = app.requestSingleInstanceLock() + +if (!gotSingleInstanceLock) { + app.quit() +} + function shouldStartHidden(): boolean { if (process.argv.includes('--hidden')) return true if (process.platform === 'darwin') { @@ -179,6 +185,10 @@ function updateTrayMenu(status: RelayStatus): void { tray.setContextMenu(menu) } +app.on('second-instance', () => { + createWindow() +}) + app.whenReady().then(() => { electronApp.setAppUserModelId('cafe.kirameki.discord-rpc-relay')