()
| 80 | } |
| 81 | |
| 82 | function initMainWindow() { |
| 83 | let mainWindowState = windowStateKeeper({ |
| 84 | defaultWidth: 1180, |
| 85 | defaultHeight: 755 |
| 86 | }); |
| 87 | |
| 88 | mainWindow = new BrowserWindow({ |
| 89 | x: mainWindowState.x, |
| 90 | y: mainWindowState.y, |
| 91 | width: mainWindowState.width, |
| 92 | height: mainWindowState.height, |
| 93 | minWidth: 800, |
| 94 | minHeight: 640, |
| 95 | center: true, |
| 96 | frame: false |
| 97 | }); |
| 98 | |
| 99 | mainWindow.loadURL(`file://${__dirname}/app/index.html`); |
| 100 | |
| 101 | if (process.env.NODE_ENV === 'development') { |
| 102 | mainWindow.webContents.openDevTools(); |
| 103 | } |
| 104 | |
| 105 | mainWindow.webContents.on('will-navigate', function (e, url) { |
| 106 | if (url.indexOf('build/index.html#') < 0) { |
| 107 | e.preventDefault(); |
| 108 | } |
| 109 | }); |
| 110 | |
| 111 | mainWindow.webContents.on('did-finish-load', function () { |
| 112 | mainWindow.setTitle('Soundnode'); |
| 113 | mainWindow.show(); |
| 114 | mainWindow.focus(); |
| 115 | }); |
| 116 | |
| 117 | mainWindowState.manage(mainWindow); |
| 118 | initializeMediaShortcuts(); |
| 119 | menuBar(); |
| 120 | } |
| 121 | |
| 122 | app.on('will-quit', () => { |
| 123 | // Unregister all shortcuts. |
no test coverage detected