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,