aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar skoruppa <skoruppa@gmail.com>2019-03-08 18:04:25 +0200
committerLibravatar Stefan Malzner <stefan@adlk.io>2019-03-08 08:04:25 -0800
commit5b02c4d3304a570562d4dd089e46624a58697f1f (patch)
tree77c5f5125c283a5305abd83fe413ab7861b7f5a3
parentcorrectly update services submenu on language change (diff)
downloadferdium-app-5b02c4d3304a570562d4dd089e46624a58697f1f.tar.gz
ferdium-app-5b02c4d3304a570562d4dd089e46624a58697f1f.tar.zst
ferdium-app-5b02c4d3304a570562d4dd089e46624a58697f1f.zip
fix(Linux): Fix minimized window focusing (#1304) (@skoruppa)
* trigger build * Check if window is minimized before restoring it * restore() should be executed only when window is minimized
-rw-r--r--src/index.js5
-rw-r--r--src/lib/Tray.js8
-rw-r--r--src/stores/AppStore.js9
3 files changed, 16 insertions, 6 deletions
diff --git a/src/index.js b/src/index.js
index 0e222c3d6..05c793d98 100644
--- a/src/index.js
+++ b/src/index.js
@@ -72,7 +72,10 @@ if (!gotTheLock) {
72 app.on('second-instance', (event, argv) => { 72 app.on('second-instance', (event, argv) => {
73 // Someone tried to run a second instance, we should focus our window. 73 // Someone tried to run a second instance, we should focus our window.
74 if (mainWindow) { 74 if (mainWindow) {
75 if (mainWindow.isMinimized()) mainWindow.restore(); 75 mainWindow.show();
76 if (mainWindow.isMinimized()) {
77 mainWindow.restore();
78 }
76 mainWindow.focus(); 79 mainWindow.focus();
77 80
78 if (isWindows) { 81 if (isWindows) {
diff --git a/src/lib/Tray.js b/src/lib/Tray.js
index 669b02709..192e24796 100644
--- a/src/lib/Tray.js
+++ b/src/lib/Tray.js
@@ -22,7 +22,11 @@ export default class TrayIcon {
22 { 22 {
23 label: 'Show Franz', 23 label: 'Show Franz',
24 click() { 24 click() {
25 if (app.mainWindow.isMinimized()) {
26 app.mainWindow.restore();
27 }
25 app.mainWindow.show(); 28 app.mainWindow.show();
29 app.mainWindow.focus();
26 }, 30 },
27 }, { 31 }, {
28 label: 'Quit Franz', 32 label: 'Quit Franz',
@@ -36,7 +40,11 @@ export default class TrayIcon {
36 this.trayIcon.setContextMenu(trayMenu); 40 this.trayIcon.setContextMenu(trayMenu);
37 41
38 this.trayIcon.on('click', () => { 42 this.trayIcon.on('click', () => {
43 if (app.mainWindow.isMinimized()) {
44 app.mainWindow.restore();
45 }
39 app.mainWindow.show(); 46 app.mainWindow.show();
47 app.mainWindow.focus();
40 }); 48 });
41 49
42 if (process.platform === 'darwin') { 50 if (process.platform === 'darwin') {
diff --git a/src/stores/AppStore.js b/src/stores/AppStore.js
index 7784ff1f9..89eb16fe2 100644
--- a/src/stores/AppStore.js
+++ b/src/stores/AppStore.js
@@ -12,7 +12,7 @@ import { URL } from 'url';
12import Store from './lib/Store'; 12import Store from './lib/Store';
13import Request from './lib/Request'; 13import Request from './lib/Request';
14import { CHECK_INTERVAL, DEFAULT_APP_SETTINGS } from '../config'; 14import { CHECK_INTERVAL, DEFAULT_APP_SETTINGS } from '../config';
15import { isMac, isLinux, isWindows } from '../environment'; 15import { isMac } from '../environment';
16import locales from '../i18n/translations'; 16import locales from '../i18n/translations';
17import { gaEvent, gaPage } from '../lib/analytics'; 17import { gaEvent, gaPage } from '../lib/analytics';
18import { onVisibilityChange } from '../helpers/visibility-helper'; 18import { onVisibilityChange } from '../helpers/visibility-helper';
@@ -195,12 +195,11 @@ export default class AppStore extends Store {
195 }); 195 });
196 196
197 this.actions.service.setActive({ serviceId }); 197 this.actions.service.setActive({ serviceId });
198 198 mainWindow.show();
199 if (isWindows) { 199 if (app.mainWindow.isMinimized()) {
200 mainWindow.restore(); 200 mainWindow.restore();
201 } else if (isLinux) {
202 mainWindow.show();
203 } 201 }
202 mainWindow.focus();
204 } 203 }
205 }; 204 };
206 } 205 }