diff options
author | 2017-11-07 12:25:00 +0100 | |
---|---|---|
committer | 2017-11-07 12:25:00 +0100 | |
commit | c55885e69e195e4413fda3bffffafeaee7c0c9d5 (patch) | |
tree | b13a2894796e45df60c92cf4c999b2974d400091 /src/index.js | |
parent | Fix lint errors (diff) | |
parent | fix(App): Prevent app from redirecting when dropping link (diff) | |
download | ferdium-app-c55885e69e195e4413fda3bffffafeaee7c0c9d5.tar.gz ferdium-app-c55885e69e195e4413fda3bffffafeaee7c0c9d5.tar.zst ferdium-app-c55885e69e195e4413fda3bffffafeaee7c0c9d5.zip |
Merge branch 'develop' into reload-crashed-service
Diffstat (limited to 'src/index.js')
-rw-r--r-- | src/index.js | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/src/index.js b/src/index.js index 030736fee..f0fe56ae5 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) { |
@@ -29,19 +26,18 @@ if (isWindows) { | |||
29 | } | 26 | } |
30 | 27 | ||
31 | // Force single window | 28 | // Force single window |
32 | if (process.platform !== 'darwin') { | 29 | const isSecondInstance = app.makeSingleInstance(() => { |
33 | const isSecondInstance = app.makeSingleInstance(() => { | 30 | if (mainWindow) { |
34 | if (mainWindow) { | 31 | if (mainWindow.isMinimized()) mainWindow.restore(); |
35 | if (mainWindow.isMinimized()) mainWindow.restore(); | 32 | mainWindow.focus(); |
36 | mainWindow.focus(); | ||
37 | } | ||
38 | }); | ||
39 | |||
40 | if (isSecondInstance) { | ||
41 | app.quit(); | ||
42 | } | 33 | } |
34 | }); | ||
35 | |||
36 | if (isSecondInstance) { | ||
37 | app.exit(); | ||
43 | } | 38 | } |
44 | 39 | ||
40 | |||
45 | // Initialize Settings | 41 | // Initialize Settings |
46 | const settings = new Settings(); | 42 | const settings = new Settings(); |
47 | 43 | ||
@@ -89,9 +85,13 @@ const createWindow = async () => { | |||
89 | // when you should delete the corresponding element. | 85 | // when you should delete the corresponding element. |
90 | if (!willQuitApp && (settings.get('runInBackground') === undefined || settings.get('runInBackground'))) { | 86 | if (!willQuitApp && (settings.get('runInBackground') === undefined || settings.get('runInBackground'))) { |
91 | e.preventDefault(); | 87 | e.preventDefault(); |
92 | mainWindow.hide(); | 88 | if (isWindows) { |
89 | mainWindow.minimize(); | ||
90 | } else { | ||
91 | mainWindow.hide(); | ||
92 | } | ||
93 | 93 | ||
94 | if (process.platform === 'win32') { | 94 | if (isWindows && settings.get('minimizeToSystemTray')) { |
95 | mainWindow.setSkipTaskbar(true); | 95 | mainWindow.setSkipTaskbar(true); |
96 | } | 96 | } |
97 | } else { | 97 | } else { |