diff options
author | 2017-11-10 17:07:13 +0100 | |
---|---|---|
committer | 2017-11-10 17:07:13 +0100 | |
commit | a6d43cf98137556453243a3457cb9a3692d7d724 (patch) | |
tree | c1247fa41e2d914806aa707a3e1a79b3af4bfa9b /src | |
parent | Merge pull request #248 from meetfranz/feature/192-display-disabled-services (diff) | |
parent | fix(macOS): Fix the need for the High Pref GPU (diff) | |
download | ferdium-app-a6d43cf98137556453243a3457cb9a3692d7d724.tar.gz ferdium-app-a6d43cf98137556453243a3457cb9a3692d7d724.tar.zst ferdium-app-a6d43cf98137556453243a3457cb9a3692d7d724.zip |
Merge pull request #255 from meetfranz/feature/117-disable-gpu
fix(macOS): Fix the need for the High Pref GPU
Diffstat (limited to 'src')
-rw-r--r-- | src/index.js | 47 |
1 files changed, 25 insertions, 22 deletions
diff --git a/src/index.js b/src/index.js index f0fe56ae5..efb3be737 100644 --- a/src/index.js +++ b/src/index.js | |||
@@ -11,8 +11,8 @@ import Settings from './electron/Settings'; | |||
11 | import { appId } from './package.json'; // eslint-disable-line import/no-unresolved | 11 | import { appId } from './package.json'; // eslint-disable-line import/no-unresolved |
12 | import './electron/exception'; | 12 | import './electron/exception'; |
13 | 13 | ||
14 | // Keep a global reference of the window object, if you don't, the window will | 14 | // Keep a global reference of the window object, if you don't, the window will |
15 | // be closed automatically when the JavaScript object is garbage collected. | 15 | // be closed automatically when the JavaScript object is garbage collected. |
16 | let mainWindow; | 16 | let mainWindow; |
17 | let willQuitApp = false; | 17 | let willQuitApp = false; |
18 | 18 | ||
@@ -37,6 +37,9 @@ if (isSecondInstance) { | |||
37 | app.exit(); | 37 | app.exit(); |
38 | } | 38 | } |
39 | 39 | ||
40 | // Lets disable Hardware Acceleration until we have a better solution | ||
41 | // to deal with the high-perf-gpu requirement of some services | ||
42 | app.disableHardwareAcceleration(); | ||
40 | 43 | ||
41 | // Initialize Settings | 44 | // Initialize Settings |
42 | const settings = new Settings(); | 45 | const settings = new Settings(); |
@@ -48,8 +51,8 @@ const createWindow = async () => { | |||
48 | defaultHeight: 600, | 51 | defaultHeight: 600, |
49 | }); | 52 | }); |
50 | 53 | ||
51 | // Create the browser window. | 54 | // Create the browser window. |
52 | mainWindow = new BrowserWindow({ | 55 | mainWindow = new BrowserWindow({ |
53 | x: mainWindowState.x, | 56 | x: mainWindowState.x, |
54 | y: mainWindowState.y, | 57 | y: mainWindowState.y, |
55 | width: mainWindowState.width, | 58 | width: mainWindowState.width, |
@@ -73,16 +76,16 @@ const createWindow = async () => { | |||
73 | // and load the index.html of the app. | 76 | // and load the index.html of the app. |
74 | mainWindow.loadURL(`file://${__dirname}/index.html`); | 77 | mainWindow.loadURL(`file://${__dirname}/index.html`); |
75 | 78 | ||
76 | // Open the DevTools. | 79 | // Open the DevTools. |
77 | if (isDevMode) { | 80 | if (isDevMode) { |
78 | mainWindow.webContents.openDevTools(); | 81 | mainWindow.webContents.openDevTools(); |
79 | } | 82 | } |
80 | 83 | ||
81 | // Emitted when the window is closed. | 84 | // Emitted when the window is closed. |
82 | mainWindow.on('close', (e) => { | 85 | mainWindow.on('close', (e) => { |
83 | // Dereference the window object, usually you would store windows | 86 | // Dereference the window object, usually you would store windows |
84 | // in an array if your app supports multi windows, this is the time | 87 | // in an array if your app supports multi windows, this is the time |
85 | // when you should delete the corresponding element. | 88 | // when you should delete the corresponding element. |
86 | if (!willQuitApp && (settings.get('runInBackground') === undefined || settings.get('runInBackground'))) { | 89 | if (!willQuitApp && (settings.get('runInBackground') === undefined || settings.get('runInBackground'))) { |
87 | e.preventDefault(); | 90 | e.preventDefault(); |
88 | if (isWindows) { | 91 | if (isWindows) { |
@@ -142,20 +145,20 @@ const createWindow = async () => { | |||
142 | shell.openExternal(url); | 145 | shell.openExternal(url); |
143 | }); | 146 | }); |
144 | }; | 147 | }; |
145 | 148 | ||
146 | // This method will be called when Electron has finished | 149 | // This method will be called when Electron has finished |
147 | // initialization and is ready to create browser windows. | 150 | // initialization and is ready to create browser windows. |
148 | // Some APIs can only be used after this event occurs. | 151 | // Some APIs can only be used after this event occurs. |
149 | app.on('ready', createWindow); | 152 | app.on('ready', createWindow); |
150 | 153 | ||
151 | // Quit when all windows are closed. | 154 | // Quit when all windows are closed. |
152 | app.on('window-all-closed', () => { | 155 | app.on('window-all-closed', () => { |
153 | // On OS X it is common for applications and their menu bar | 156 | // On OS X it is common for applications and their menu bar |
154 | // to stay active until the user quits explicitly with Cmd + Q | 157 | // to stay active until the user quits explicitly with Cmd + Q |
155 | if (settings.get('runInBackground') === undefined | 158 | if (settings.get('runInBackground') === undefined |
156 | || settings.get('runInBackground')) { | 159 | || settings.get('runInBackground')) { |
157 | app.quit(); | 160 | app.quit(); |
158 | } | 161 | } |
159 | }); | 162 | }); |
160 | 163 | ||
161 | app.on('before-quit', () => { | 164 | app.on('before-quit', () => { |