diff options
author | 2017-11-06 16:01:09 +0100 | |
---|---|---|
committer | 2017-11-06 16:01:09 +0100 | |
commit | 4e75616ddd763999cc4527154e3c466bdeebf87f (patch) | |
tree | f0bec80833c4c6ab4ac165a6212a73f9238b19f0 /src/index.js | |
parent | Bump version to beta 13 (diff) | |
parent | Merge pull request #227 from meetfranz/feature/win-skip-taskbar-minimize-systray (diff) | |
download | ferdium-app-4e75616ddd763999cc4527154e3c466bdeebf87f.tar.gz ferdium-app-4e75616ddd763999cc4527154e3c466bdeebf87f.tar.zst ferdium-app-4e75616ddd763999cc4527154e3c466bdeebf87f.zip |
Merge branch 'develop' of github.com:meetfranz/franz into develop
Diffstat (limited to 'src/index.js')
-rw-r--r-- | src/index.js | 34 |
1 files changed, 15 insertions, 19 deletions
diff --git a/src/index.js b/src/index.js index a3aa14732..f0fe56ae5 100644 --- a/src/index.js +++ b/src/index.js | |||
@@ -26,19 +26,18 @@ if (isWindows) { | |||
26 | } | 26 | } |
27 | 27 | ||
28 | // Force single window | 28 | // Force single window |
29 | if (process.platform !== 'darwin') { | 29 | const isSecondInstance = app.makeSingleInstance(() => { |
30 | const isSecondInstance = app.makeSingleInstance(() => { | 30 | if (mainWindow) { |
31 | if (mainWindow) { | 31 | if (mainWindow.isMinimized()) mainWindow.restore(); |
32 | if (mainWindow.isMinimized()) mainWindow.restore(); | 32 | mainWindow.focus(); |
33 | mainWindow.focus(); | ||
34 | } | ||
35 | }); | ||
36 | |||
37 | if (isSecondInstance) { | ||
38 | app.quit(); | ||
39 | } | 33 | } |
34 | }); | ||
35 | |||
36 | if (isSecondInstance) { | ||
37 | app.exit(); | ||
40 | } | 38 | } |
41 | 39 | ||
40 | |||
42 | // Initialize Settings | 41 | // Initialize Settings |
43 | const settings = new Settings(); | 42 | const settings = new Settings(); |
44 | 43 | ||
@@ -86,9 +85,13 @@ const createWindow = async () => { | |||
86 | // when you should delete the corresponding element. | 85 | // when you should delete the corresponding element. |
87 | if (!willQuitApp && (settings.get('runInBackground') === undefined || settings.get('runInBackground'))) { | 86 | if (!willQuitApp && (settings.get('runInBackground') === undefined || settings.get('runInBackground'))) { |
88 | e.preventDefault(); | 87 | e.preventDefault(); |
89 | mainWindow.hide(); | 88 | if (isWindows) { |
89 | mainWindow.minimize(); | ||
90 | } else { | ||
91 | mainWindow.hide(); | ||
92 | } | ||
90 | 93 | ||
91 | if (process.platform === 'win32') { | 94 | if (isWindows && settings.get('minimizeToSystemTray')) { |
92 | mainWindow.setSkipTaskbar(true); | 95 | mainWindow.setSkipTaskbar(true); |
93 | } | 96 | } |
94 | } else { | 97 | } else { |
@@ -111,13 +114,6 @@ const createWindow = async () => { | |||
111 | app.isMaximized = true; | 114 | app.isMaximized = true; |
112 | }); | 115 | }); |
113 | 116 | ||
114 | mainWindow.on('close', (e) => { | ||
115 | if (settings.get('minimizeToSystemTray')) { | ||
116 | e.preventDefault(); | ||
117 | mainWindow.minimize(); | ||
118 | } | ||
119 | }); | ||
120 | |||
121 | mainWindow.on('unmaximize', () => { | 117 | mainWindow.on('unmaximize', () => { |
122 | app.isMaximized = false; | 118 | app.isMaximized = false; |
123 | }); | 119 | }); |