()
| 19 | let mainWindow: Electron.BrowserWindow | null |
| 20 | |
| 21 | function createWindow() { |
| 22 | const icon = nativeImage.createFromPath(`${app.getAppPath()}/build/icon.png`) |
| 23 | |
| 24 | if (app.dock) { |
| 25 | app.dock.setIcon(icon) |
| 26 | } |
| 27 | |
| 28 | mainWindow = new BrowserWindow({ |
| 29 | ...getWindowBounds(), |
| 30 | icon, |
| 31 | minWidth: 1000, |
| 32 | minHeight: 600, |
| 33 | frame: false, |
| 34 | transparent: true, |
| 35 | webPreferences: { |
| 36 | nodeIntegration: true, |
| 37 | enableRemoteModule: true |
| 38 | } |
| 39 | }) |
| 40 | |
| 41 | if (process.env.NODE_ENV === 'development') { |
| 42 | mainWindow.loadURL('http://localhost:4000') |
| 43 | } else { |
| 44 | mainWindow.loadURL( |
| 45 | url.format({ |
| 46 | pathname: path.join(__dirname, 'renderer/index.html'), |
| 47 | protocol: 'file:', |
| 48 | slashes: true |
| 49 | }) |
| 50 | ) |
| 51 | } |
| 52 | |
| 53 | mainWindow.on('close', () => { |
| 54 | setWindowBounds(mainWindow?.getBounds()) |
| 55 | }) |
| 56 | |
| 57 | mainWindow.on('closed', () => { |
| 58 | mainWindow = null |
| 59 | }) |
| 60 | } |
| 61 | |
| 62 | async function createMenu() { |
| 63 | await i18n.loadNamespaces('applicationMenu') |
no test coverage detected