From ea55a9088358fda3828dd2a29f12ee20201ccde4 Mon Sep 17 00:00:00 2001 From: tigerbot Date: Mon, 24 Apr 2017 18:22:44 -0600 Subject: [PATCH] made window properly hidden on auto-startup --- index.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/index.js b/index.js index ceae948..542d95e 100644 --- a/index.js +++ b/index.js @@ -6,6 +6,11 @@ var url = require('url'); require('./crash-reporter'); +// 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.) +var hidden = process.argv.includes('--hidden') || + (process.platform === 'darwin' && app.getLoginItemSettings().wasOpenedAsHidden); + // Keep a global reference of the window object, if you don't, the window will // be closed automatically when the JavaScript object is garbage collected. var win; @@ -15,6 +20,7 @@ function createWindow () { win = new BrowserWindow({ title: 'Electron Demo', icon: path.join(__dirname, 'images', 'daplie-logo.png'), + show: !hidden, width: 800, height: 600, minWidth: 280,