diff options
Diffstat (limited to 'src/index.js')
-rw-r--r-- | src/index.js | 35 |
1 files changed, 24 insertions, 11 deletions
diff --git a/src/index.js b/src/index.js index f82bb3590..7d906ad71 100644 --- a/src/index.js +++ b/src/index.js | |||
@@ -4,7 +4,7 @@ import path from 'path'; | |||
4 | 4 | ||
5 | import windowStateKeeper from 'electron-window-state'; | 5 | import windowStateKeeper from 'electron-window-state'; |
6 | 6 | ||
7 | import { isDevMode, isWindows } from './environment'; | 7 | import { isDevMode, isMac, isWindows, isLinux } from './environment'; |
8 | import ipcApi from './electron/ipc-api'; | 8 | import ipcApi from './electron/ipc-api'; |
9 | import Tray from './lib/Tray'; | 9 | import Tray from './lib/Tray'; |
10 | import Settings from './electron/Settings'; | 10 | import Settings from './electron/Settings'; |
@@ -12,14 +12,21 @@ import handleDeepLink from './electron/deepLinking'; | |||
12 | import { appId } from './package.json'; // eslint-disable-line import/no-unresolved | 12 | import { appId } from './package.json'; // eslint-disable-line import/no-unresolved |
13 | import './electron/exception'; | 13 | import './electron/exception'; |
14 | 14 | ||
15 | const debug = require('debug')('Franz:App'); | ||
16 | |||
15 | // Keep a global reference of the window object, if you don't, the window will | 17 | // Keep a global reference of the window object, if you don't, the window will |
16 | // be closed automatically when the JavaScript object is garbage collected. | 18 | // be closed automatically when the JavaScript object is garbage collected. |
17 | let mainWindow; | 19 | let mainWindow; |
18 | let willQuitApp = false; | 20 | let willQuitApp = false; |
19 | 21 | ||
22 | // DEV MODE: Save user data into FranzDev | ||
23 | if (isDevMode) { | ||
24 | app.setPath('userData', path.join(app.getPath('appData'), 'FranzDev')); | ||
25 | } | ||
26 | |||
20 | // Ensure that the recipe directory exists | 27 | // Ensure that the recipe directory exists |
21 | fs.ensureDir(path.join(app.getPath('userData'), 'recipes')); | ||
22 | fs.emptyDirSync(path.join(app.getPath('userData'), 'recipes', 'temp')); | 28 | fs.emptyDirSync(path.join(app.getPath('userData'), 'recipes', 'temp')); |
29 | fs.ensureFileSync(path.join(app.getPath('userData'), 'window-state.json')); | ||
23 | 30 | ||
24 | // Set App ID for Windows | 31 | // Set App ID for Windows |
25 | if (isWindows) { | 32 | if (isWindows) { |
@@ -48,15 +55,21 @@ if (isSecondInstance) { | |||
48 | app.exit(); | 55 | app.exit(); |
49 | } | 56 | } |
50 | 57 | ||
51 | // Lets disable Hardware Acceleration until we have a better solution | 58 | // Fix Unity indicator issue |
52 | // to deal with the high-perf-gpu requirement of some services | 59 | // https://github.com/electron/electron/issues/9046 |
53 | 60 | if (isLinux && ['Pantheon', 'Unity:Unity7'].indexOf(process.env.XDG_CURRENT_DESKTOP) !== -1) { | |
54 | // Disabled to test tweetdeck glitches | 61 | process.env.XDG_CURRENT_DESKTOP = 'Unity'; |
55 | // app.disableHardwareAcceleration(); | 62 | } |
56 | 63 | ||
57 | // Initialize Settings | 64 | // Initialize Settings |
58 | const settings = new Settings(); | 65 | const settings = new Settings(); |
59 | 66 | ||
67 | // Disable GPU acceleration | ||
68 | if (!settings.get('enableGPUAcceleration')) { | ||
69 | debug('Disable GPU Acceleration'); | ||
70 | app.disableHardwareAcceleration(); | ||
71 | } | ||
72 | |||
60 | const createWindow = () => { | 73 | const createWindow = () => { |
61 | // Remember window size | 74 | // Remember window size |
62 | const mainWindowState = windowStateKeeper({ | 75 | const mainWindowState = windowStateKeeper({ |
@@ -72,9 +85,9 @@ const createWindow = () => { | |||
72 | height: mainWindowState.height, | 85 | height: mainWindowState.height, |
73 | minWidth: 600, | 86 | minWidth: 600, |
74 | minHeight: 500, | 87 | minHeight: 500, |
75 | titleBarStyle: 'hidden', | 88 | titleBarStyle: isMac ? 'hidden' : '', |
76 | backgroundColor: '#3498db', | 89 | frame: isLinux, |
77 | autoHideMenuBar: true, | 90 | backgroundColor: !settings.get('darkMode') ? '#3498db' : '#1E1E1E', |
78 | }); | 91 | }); |
79 | 92 | ||
80 | // Initialize System Tray | 93 | // Initialize System Tray |
@@ -107,7 +120,7 @@ const createWindow = () => { | |||
107 | mainWindow.hide(); | 120 | mainWindow.hide(); |
108 | } | 121 | } |
109 | 122 | ||
110 | if (isWindows && settings.get('minimizeToSystemTray')) { | 123 | if (isWindows) { |
111 | mainWindow.setSkipTaskbar(true); | 124 | mainWindow.setSkipTaskbar(true); |
112 | } | 125 | } |
113 | } else { | 126 | } else { |