made window properly hidden on auto-startup
This commit is contained in:
		
							parent
							
								
									e1039de5fd
								
							
						
					
					
						commit
						ea55a90883
					
				
							
								
								
									
										6
									
								
								index.js
									
									
									
									
									
								
							
							
						
						
									
										6
									
								
								index.js
									
									
									
									
									
								
							| @ -6,6 +6,11 @@ var url = require('url'); | |||||||
| 
 | 
 | ||||||
| require('./crash-reporter'); | 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
 | // 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.
 | // be closed automatically when the JavaScript object is garbage collected.
 | ||||||
| var win; | var win; | ||||||
| @ -15,6 +20,7 @@ function createWindow () { | |||||||
|   win = new BrowserWindow({ |   win = new BrowserWindow({ | ||||||
|     title: 'Electron Demo', |     title: 'Electron Demo', | ||||||
|     icon:  path.join(__dirname, 'images', 'daplie-logo.png'), |     icon:  path.join(__dirname, 'images', 'daplie-logo.png'), | ||||||
|  |     show: !hidden, | ||||||
|     width:  800, |     width:  800, | ||||||
|     height: 600, |     height: 600, | ||||||
|     minWidth:  280, |     minWidth:  280, | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user