diff options
-rw-r--r-- | CHANGELOG.md | 8 | ||||
-rw-r--r-- | package.json | 2 | ||||
-rw-r--r-- | src/index.js | 34 |
3 files changed, 24 insertions, 20 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index 5b5a0755c..024afe93c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md | |||
@@ -1,3 +1,11 @@ | |||
1 | <a name="5.0.0-beta.13"></a> | ||
2 | # [5.0.0-beta.13](https://github.com/meetfranz/franz/compare/v5.0.0-beta.12...v5.0.0-beta.13) (2017-11-06) | ||
3 | |||
4 | ### Bug Fixes | ||
5 | |||
6 | * **Windows:** Fix issue with multiple close handlers that prevent the app from quitting ([eea593e](https://github.com/meetfranz/franz/commit/eea593e)) | ||
7 | |||
8 | |||
1 | <a name="5.0.0-beta.12"></a> | 9 | <a name="5.0.0-beta.12"></a> |
2 | # [5.0.0-beta.12](https://github.com/meetfranz/franz/compare/v5.0.0-beta.11...v5.0.0-beta.12) (2017-11-05) | 10 | # [5.0.0-beta.12](https://github.com/meetfranz/franz/compare/v5.0.0-beta.11...v5.0.0-beta.12) (2017-11-05) |
3 | 11 | ||
diff --git a/package.json b/package.json index 057dc6d60..9b56cdf27 100644 --- a/package.json +++ b/package.json | |||
@@ -2,7 +2,7 @@ | |||
2 | "name": "franz", | 2 | "name": "franz", |
3 | "productName": "Franz", | 3 | "productName": "Franz", |
4 | "appId": "com.meetfranz.franz", | 4 | "appId": "com.meetfranz.franz", |
5 | "version": "5.0.0-beta.12", | 5 | "version": "5.0.0-beta.13", |
6 | "description": "Messaging app for WhatsApp, Slack, Telegram, HipChat, Hangouts and many many more.", | 6 | "description": "Messaging app for WhatsApp, Slack, Telegram, HipChat, Hangouts and many many more.", |
7 | "copyright": "adlk x franz - Stefan Malzner", | 7 | "copyright": "adlk x franz - Stefan Malzner", |
8 | "main": "index.js", | 8 | "main": "index.js", |
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 | }); |