diff --git a/src/main/MainRunner.js b/src/main/MainRunner.js index 5fed381..59e2044 100644 --- a/src/main/MainRunner.js +++ b/src/main/MainRunner.js @@ -1,16 +1,12 @@ import { app, BrowserWindow } from 'electron' -import path from 'path' import Constants from './utils/Constants' - -const BROWSER_WINDOW_DEFAULT = { - title: Constants.APP_NAME, - icon: path.join(__static, Constants.APP_ICON) -} +import Utils from './utils' export default class MainRunner { static async createMainWindow (mainWindow) { mainWindow = new BrowserWindow({ - ...BROWSER_WINDOW_DEFAULT, + title: Constants.APP_NAME, + icon: Utils.getAppIcon(), show: false, width: Constants.IS_DEV_ENV ? 1500 : 1200, height: 650, @@ -52,6 +48,8 @@ export default class MainRunner { } errorWindow = new BrowserWindow({ + title: Constants.APP_NAME, + icon: Utils.getAppIcon(), show: false, resizable: Constants.IS_DEV_ENV, webPreferences: Constants.DEFAULT_WEB_PREFERENCES diff --git a/src/main/index.js b/src/main/index.js index fe32046..0d6b888 100644 --- a/src/main/index.js +++ b/src/main/index.js @@ -8,14 +8,14 @@ import * as electronRemote from '@electron/remote/main' let mainWindow let errorWindow -if (!Constants.IS_DEV_ENV) { - global.__static = path.join(path.dirname(fileURLToPath(import.meta.url)), '/static') - .replace(/\\/g, '\\\\') -} - app.on('ready', () => { electronRemote.initialize() + if (!Constants.IS_DEV_ENV) { + global.__static = path.join(path.dirname(fileURLToPath(import.meta.url)), '/static') + .replace(/\\/g, '\\\\') + } + mainWindow = MainRunner.createMainWindow(mainWindow) }) diff --git a/src/main/utils/index.js b/src/main/utils/index.js new file mode 100644 index 0000000..8090700 --- /dev/null +++ b/src/main/utils/index.js @@ -0,0 +1,8 @@ +import path from 'path' +import Constants from './Constants' + +export default class Utils { + static getAppIcon () { + return path.join(__static, Constants.APP_ICON) + } +}