From e827df58c0e35929958d4fe87a775b2871334b9d Mon Sep 17 00:00:00 2001 From: Oj Date: Sun, 26 Dec 2021 17:48:09 +0000 Subject: [PATCH] [Bootstrap] Add --start-minimized support --- src/bootstrap.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/bootstrap.js b/src/bootstrap.js index f529003..dd4b3f3 100644 --- a/src/bootstrap.js +++ b/src/bootstrap.js @@ -6,6 +6,7 @@ log('Bootstrap', 'Forcing Electron props'); app.name = 'discord'; // Force name as sometimes breaks data path even with "discord" name (also fixes kernel?) const requireNative = require('./utils/requireNative'); +const argv = require('./utils/argv'); const paths = require('./paths'); global.moduleDataPath = paths.getModuleDataPath(); // Global because discord @@ -89,7 +90,10 @@ const startCore = () => { }; const startUpdate = () => { - appUpdater.update(false, () => { + const startMinimized = argv.hasFlag('--start-minimized'); + log('Bootstrap', 'Start minimized:', startMinimized); + + appUpdater.update(startMinimized, () => { if (process.env.OPENASAR_NOSTART) { log('Bootstrap', 'Found nostart variable, halting bootstrap'); return; @@ -98,7 +102,7 @@ const startUpdate = () => { startCore(); }, () => { log('Bootstrap', 'Setting main window visible'); - desktopCore.setMainWindowVisible(true); + desktopCore.setMainWindowVisible(!startMinimized); setTimeout(() => { // Try to update our asar if (oaConfig.autoupdate === false) return; // If autoupdate disabled, don't update @@ -140,4 +144,4 @@ getInstallPath: ${paths.getInstallPath()}`); } else { app.once('ready', startUpdate); } -}; +}; \ No newline at end of file