From 64f49e4d4fa742d18809e54be3edd93d65055c39 Mon Sep 17 00:00:00 2001 From: DC Date: Tue, 13 Sep 2016 19:40:19 -0700 Subject: [PATCH] Auto launch: start minimized on MacOS --- src/main/index.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/main/index.js b/src/main/index.js index 5eac4567..8eb62626 100644 --- a/src/main/index.js +++ b/src/main/index.js @@ -20,7 +20,11 @@ const windows = require('./windows') let shouldQuit = false let argv = sliceArgv(process.argv) -const hidden = argv.includes('--hidden') + +// Start the app without showing the main window when auto launching on login +// (On Windows and Linux, we get a flag. On MacOS, we get special API.) +const hidden = argv.includes('--hidden') || + (process.platform === 'darwin' && app.getLoginItemSettings().wasOpenedAsHidden) if (config.IS_PRODUCTION) { // When Electron is running in production mode (packaged app), then run React @@ -157,7 +161,7 @@ function processArgv (argv) { } else if (arg === '-u') { dialog.openTorrentAddress() } else if (arg === '--hidden') { - // Igonre hidden argument, already being handled + // Ignore hidden argument, already being handled } else if (arg.startsWith('-psn')) { // Ignore Mac launchd "process serial number" argument // Issue: https://github.com/feross/webtorrent-desktop/issues/214