import { BrowserWindow , NativeImage , nativeImage , ipcMain , screen , } from 'electron' ; import * as os from 'os' ; import * as url from 'url' ; import * as path from 'path' ; import electronIsDev from 'electron-is-dev' ; import electronStore from 'electron-store' ; import manageWindowState from './winState' ; export default function createMainWindow ( ) { let mainWindowState = manageWindowState ( { width : 992 , height : 558 } ) ; let mainWindow ; let store = new electronStore ( { name : 'settings' , } ) ; let unobtusive = ! store . has ( 'system.unobtrusive' ) || store . get ( 'system.unobtrusive' ) === true ? true : false ; mainWindow = new BrowserWindow ( { frame : os . platform ( ) === 'darwin' ? true : false , titleBarStyle : 'hiddenInset' , maximizable : ! unobtusive , minimizable : ! unobtusive , show : ! unobtusive , minHeight : 558 , minWidth : 992 , height : mainWindowState . height , width : mainWindowState . width , webPreferences : { nodeIntegration : true , } , } ) ; mainWindow . loadURL ( url . format ( { pathname : path . join ( __dirname , './index.html' ) , protocol : 'file:' , slashes : true , } ) ) ; if ( electronIsDev ) { mainWindow . webContents . openDevTools ( ) ; } mainWindow . on ( 'closed' , ( ) => { mainWindow = null ; } ) ; if ( unobtusive ) { mainWindow . setAlwaysOnTop ( true ) ; } mainWindowState . trackResize ( mainWindow ) ; return mainWindow ; }