diff --git a/index.js b/index.js index 42f86453..0df74743 100644 --- a/index.js +++ b/index.js @@ -7,45 +7,17 @@ const { app } = require('electron'), const ElectronSentry = require("@sentry/electron"); ElectronSentry.init({ dsn: "https://68c422bfaaf44dea880b86aad5a820d2@o954055.ingest.sentry.io/6112214" }); -// Enable WebGPU and list adapters (EXPERIMENTAL.) -// Note: THIS HAS TO BE BEFORE ANYTHING GETS INITIALIZED. - // const {Init} = require("./src/main/cider-base"); // Init() -CiderBase.Init() - -switch (app.cfg.get("visual.hw_acceleration")) { - default: - case "default": - - break; - case "webgpu": - console.info("WebGPU is enabled."); - app.commandLine.appendSwitch('enable-unsafe-webgpu') - break; - case "disabled": - console.info("Hardware acceleration is disabled."); - app.commandLine.appendSwitch('disable-gpu') - break; -} - -if (process.platform === "linux") { - app.commandLine.appendSwitch('disable-features', 'MediaSessionService'); -} - +CiderBase.Init().catch(() => {}) /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * App Event Handlers * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/ -app.commandLine.appendSwitch('js-flags', '--max-old-space-size=1024') - app.on('ready', () => { if (app.isQuiting) { app.quit(); return; } - app.commandLine.appendSwitch('high-dpi-support', 1) - app.commandLine.appendSwitch('force-device-scale-factor', 1) - app.commandLine.appendSwitch('disable-pinch'); - + console.log('[Cider] Application is Ready. Creating Window.') if (!app.isPackaged) { console.info('[Cider] Running in development mode.') diff --git a/src/main/cider-base.js b/src/main/cider-base.js index db0a7074..0b77d88d 100644 --- a/src/main/cider-base.js +++ b/src/main/cider-base.js @@ -3,6 +3,7 @@ const win = require('./base/win') // Analytics for debugging. const ElectronSentry = require("@sentry/electron"); +const {app} = require("electron"); ElectronSentry.init({dsn: "https://68c422bfaaf44dea880b86aad5a820d2@o954055.ingest.sentry.io/6112214"}); module.exports = { @@ -19,12 +20,43 @@ module.exports = { }, /** - * Initializes the main application (run before on-ready) - */ - Init() { + * Initializes the main application (run before on-ready) + */ + async Init() { // Initialize the config. const {init} = require("./base/store"); - init() + await init() + + //------------------------------------------------------------------------------- + // Append Commandline Arguments + //------------------------------------------------------------------------------- + + // Hardware Acceleration + // Enable WebGPU and list adapters (EXPERIMENTAL.) + // Note: THIS HAS TO BE BEFORE ANYTHING GETS INITIALIZED. + switch (app.cfg.get("visual.hw_acceleration")) { + default: + case "default": + + break; + case "webgpu": + console.info("WebGPU is enabled."); + app.commandLine.appendSwitch('enable-unsafe-webgpu') + break; + case "disabled": + console.info("Hardware acceleration is disabled."); + app.commandLine.appendSwitch('disable-gpu') + break; + } + + if (process.platform === "linux") { + app.commandLine.appendSwitch('disable-features', 'MediaSessionService'); + } + + app.commandLine.appendSwitch('high-dpi-support', 'true'); + app.commandLine.appendSwitch('force-device-scale-factor', '1'); + app.commandLine.appendSwitch('disable-pinch'); + app.commandLine.appendSwitch('js-flags', '--max-old-space-size=1024') }, /**