From 7ed7d3045f94e4f0a5b525aa3d0c0317df390a7b Mon Sep 17 00:00:00 2001 From: HorizonCode Date: Wed, 28 Jun 2023 11:38:56 +0200 Subject: [PATCH] prevent closing when ingame --- app.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/app.js b/app.js index 8325c5f..27d2c95 100644 --- a/app.js +++ b/app.js @@ -157,6 +157,9 @@ const run = () => { tray.setContextMenu(trayMenu) mainWindow = createWindow(); + mainWindow.on('close', (e) => { + if (isIngame) e.preventDefault(); + }); mainWindow.once('show', async () => { await updateConfigVars(mainWindow); await tryLogin(mainWindow); @@ -230,6 +233,7 @@ const run = () => { await osuUtil.replaceUI(osuFolder, true); rpc.updateState("Launching osu!..."); isIngame = true; + mainWindow.closable = false; if (mainWindow.isVisible()) mainWindow.hide(); const result = await osuUtil.startOsuWithDevServer(tempOsuPath, "ez-pp.farm", async () => { if (!mainWindow.isVisible()) mainWindow.show(); @@ -237,6 +241,7 @@ const run = () => { isIngame = false; await osuUtil.replaceUI(osuFolder, false); await doUpdateCheck(mainWindow); + mainWindow.closable = true; }, 2000); }); return result;