Make IS_DEV force new instance

This commit is contained in:
Vendicated 2023-04-15 20:23:47 +02:00
parent d0e7a319d6
commit 7a2161d746
No known key found for this signature in database
GPG key ID: A1DC0CFB5615D905

View file

@ -28,12 +28,10 @@ const runVencordMain = once(() => require(join(VENCORD_FILES_DIR, "vencordDeskto
let mainWin: BrowserWindow | null = null; let mainWin: BrowserWindow | null = null;
if (!app.requestSingleInstanceLock()) { function init() {
console.log("Vencord Desktop is already running. Quitting..."); app.on("second-instance", (_event, _cmdLine, _cwd, data: any) => {
app.quit(); if (data.IS_DEV) app.quit();
} else { else if (mainWin) {
app.on("second-instance", () => {
if (mainWin) {
if (mainWin.isMinimized()) mainWin.restore(); if (mainWin.isMinimized()) mainWin.restore();
if (!mainWin.isVisible()) mainWin.show(); if (!mainWin.isVisible()) mainWin.show();
mainWin.focus(); 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() { async function createWindows() {
const splash = createSplashWindow(); const splash = createSplashWindow();