diff options
author | 2017-11-05 23:31:21 +0100 | |
---|---|---|
committer | 2017-11-05 23:31:21 +0100 | |
commit | 84bff14bf649969b3729b2c751b423d33e508f0b (patch) | |
tree | a585b92b88fa10998a7100b78152b2a18f388968 /src/index.js | |
parent | Merge pull request #213 from alecive/master (diff) | |
parent | bump version to beta 12 (diff) | |
download | ferdium-app-84bff14bf649969b3729b2c751b423d33e508f0b.tar.gz ferdium-app-84bff14bf649969b3729b2c751b423d33e508f0b.tar.zst ferdium-app-84bff14bf649969b3729b2c751b423d33e508f0b.zip |
Merge pull request #217 from meetfranz/developv5.0.0-beta.125.0.0-beta.12
Beta 12
Diffstat (limited to 'src/index.js')
-rw-r--r-- | src/index.js | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/src/index.js b/src/index.js index 9ca059f48..a3aa14732 100644 --- a/src/index.js +++ b/src/index.js | |||
@@ -2,18 +2,14 @@ import { app, BrowserWindow, shell } from 'electron'; | |||
2 | import fs from 'fs-extra'; | 2 | import fs from 'fs-extra'; |
3 | import path from 'path'; | 3 | import path from 'path'; |
4 | 4 | ||
5 | /* eslint-disable */ | ||
6 | if (require('electron-squirrel-startup')) app.quit(); | ||
7 | |||
8 | import windowStateKeeper from 'electron-window-state'; | 5 | import windowStateKeeper from 'electron-window-state'; |
9 | 6 | ||
10 | import { isDevMode, isWindows } from './environment'; | 7 | import { isDevMode, isWindows } from './environment'; |
11 | import ipcApi from './electron/ipc-api'; | 8 | import ipcApi from './electron/ipc-api'; |
12 | import Tray from './lib/Tray'; | 9 | import Tray from './lib/Tray'; |
13 | import Settings from './electron/Settings'; | 10 | import Settings from './electron/Settings'; |
14 | import { appId } from './package.json'; | 11 | import { appId } from './package.json'; // eslint-disable-line import/no-unresolved |
15 | import './electron/exception'; | 12 | import './electron/exception'; |
16 | /* eslint-enable */ | ||
17 | 13 | ||
18 | // 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 |
19 | // be closed automatically when the JavaScript object is garbage collected. | 15 | // be closed automatically when the JavaScript object is garbage collected. |
@@ -22,6 +18,7 @@ let willQuitApp = false; | |||
22 | 18 | ||
23 | // Ensure that the recipe directory exists | 19 | // Ensure that the recipe directory exists |
24 | fs.ensureDir(path.join(app.getPath('userData'), 'recipes')); | 20 | fs.ensureDir(path.join(app.getPath('userData'), 'recipes')); |
21 | fs.emptyDirSync(path.join(app.getPath('userData'), 'recipes', 'temp')); | ||
25 | 22 | ||
26 | // Set App ID for Windows | 23 | // Set App ID for Windows |
27 | if (isWindows) { | 24 | if (isWindows) { |
@@ -66,7 +63,7 @@ const createWindow = async () => { | |||
66 | }); | 63 | }); |
67 | 64 | ||
68 | // Initialize System Tray | 65 | // Initialize System Tray |
69 | const trayIcon = new Tray(mainWindow); | 66 | const trayIcon = new Tray(); |
70 | 67 | ||
71 | // Initialize ipcApi | 68 | // Initialize ipcApi |
72 | ipcApi({ mainWindow, settings, trayIcon }); | 69 | ipcApi({ mainWindow, settings, trayIcon }); |
@@ -114,6 +111,13 @@ const createWindow = async () => { | |||
114 | app.isMaximized = true; | 111 | app.isMaximized = true; |
115 | }); | 112 | }); |
116 | 113 | ||
114 | mainWindow.on('close', (e) => { | ||
115 | if (settings.get('minimizeToSystemTray')) { | ||
116 | e.preventDefault(); | ||
117 | mainWindow.minimize(); | ||
118 | } | ||
119 | }); | ||
120 | |||
117 | mainWindow.on('unmaximize', () => { | 121 | mainWindow.on('unmaximize', () => { |
118 | app.isMaximized = false; | 122 | app.isMaximized = false; |
119 | }); | 123 | }); |