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')