2021-04-06 13:03:44 +00:00
|
|
|
import { app } from 'electron'
|
|
|
|
import logger from 'electron-log'
|
|
|
|
|
|
|
|
import TrayUtility from './tray'
|
|
|
|
import Settings from './settings'
|
|
|
|
import Banner from './banner'
|
2021-04-06 15:18:36 +00:00
|
|
|
import Updater from './updater'
|
2021-04-06 13:03:44 +00:00
|
|
|
|
2021-04-07 10:00:09 +00:00
|
|
|
export const DEV = !app.isPackaged && false
|
2021-04-06 13:03:44 +00:00
|
|
|
|
2021-04-07 08:25:31 +00:00
|
|
|
// Enforce single instance
|
|
|
|
const isMain = app.requestSingleInstanceLock()
|
2021-04-07 10:00:09 +00:00
|
|
|
if (!isMain) app.quit()
|
2021-04-07 08:25:31 +00:00
|
|
|
|
2021-04-06 13:03:44 +00:00
|
|
|
// Disable gpu
|
|
|
|
app.disableHardwareAcceleration()
|
|
|
|
app.commandLine.appendSwitch('disable-software-rasterizer')
|
|
|
|
|
|
|
|
logger.catchErrors({ showDialog: true })
|
|
|
|
logger.log('Starting')
|
|
|
|
app
|
|
|
|
.whenReady()
|
|
|
|
.then(() => {
|
|
|
|
logger.log('Initializing')
|
2021-04-06 21:08:13 +00:00
|
|
|
if (!DEV) app.dock?.hide()
|
2021-04-06 13:03:44 +00:00
|
|
|
TrayUtility.init()
|
|
|
|
Settings.init()
|
|
|
|
Banner.init()
|
2021-04-06 15:18:36 +00:00
|
|
|
Updater.init()
|
2021-04-06 13:03:44 +00:00
|
|
|
logger.log('Done')
|
|
|
|
})
|
|
|
|
.catch((e) => {
|
|
|
|
logger.error(e)
|
|
|
|
process.exit(1)
|
|
|
|
})
|
|
|
|
|
|
|
|
app.on('window-all-closed', () => {
|
|
|
|
// Prevent closing of the app
|
|
|
|
})
|