From 7a2161d746067f488dc1e57dc3a185e36a048b9d Mon Sep 17 00:00:00 2001 From: Vendicated Date: Sat, 15 Apr 2023 20:23:47 +0200 Subject: [PATCH] Make IS_DEV force new instance --- src/main/index.ts | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/src/main/index.ts b/src/main/index.ts index c10ccb4..4671cfb 100644 --- a/src/main/index.ts +++ b/src/main/index.ts @@ -28,12 +28,10 @@ const runVencordMain = once(() => require(join(VENCORD_FILES_DIR, "vencordDeskto let mainWin: BrowserWindow | null = null; -if (!app.requestSingleInstanceLock()) { - console.log("Vencord Desktop is already running. Quitting..."); - app.quit(); -} else { - app.on("second-instance", () => { - if (mainWin) { +function init() { + app.on("second-instance", (_event, _cmdLine, _cwd, data: any) => { + if (data.IS_DEV) app.quit(); + else if (mainWin) { if (mainWin.isMinimized()) mainWin.restore(); if (!mainWin.isVisible()) mainWin.show(); mainWin.focus(); @@ -53,6 +51,18 @@ if (!app.requestSingleInstanceLock()) { }); } +if (!app.requestSingleInstanceLock({ IS_DEV })) { + if (IS_DEV) { + console.log("Vencord Desktop is already running. Quitting previous instance..."); + init(); + } else { + console.log("Vencord Desktop is already running. Quitting..."); + app.quit(); + } +} else { + init(); +} + async function createWindows() { const splash = createSplashWindow();