made window properly hidden on auto-startup

This commit is contained in:
tigerbot 2017-04-24 18:22:44 -06:00
parent e1039de5fd
commit ea55a90883
1 changed files with 6 additions and 0 deletions

View File

@ -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,