Skip to content

Commit 5b02c4d

Browse files
skoruppaadlk
authored andcommitted
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
1 parent c62a6a6 commit 5b02c4d

File tree

3 files changed

+16
-6
lines changed

3 files changed

+16
-6
lines changed

src/index.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,10 @@ if (!gotTheLock) {
7272
app.on('second-instance', (event, argv) => {
7373
// Someone tried to run a second instance, we should focus our window.
7474
if (mainWindow) {
75-
if (mainWindow.isMinimized()) mainWindow.restore();
75+
mainWindow.show();
76+
if (mainWindow.isMinimized()) {
77+
mainWindow.restore();
78+
}
7679
mainWindow.focus();
7780

7881
if (isWindows) {

src/lib/Tray.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,11 @@ export default class TrayIcon {
2222
{
2323
label: 'Show Franz',
2424
click() {
25+
if (app.mainWindow.isMinimized()) {
26+
app.mainWindow.restore();
27+
}
2528
app.mainWindow.show();
29+
app.mainWindow.focus();
2630
},
2731
}, {
2832
label: 'Quit Franz',
@@ -36,7 +40,11 @@ export default class TrayIcon {
3640
this.trayIcon.setContextMenu(trayMenu);
3741

3842
this.trayIcon.on('click', () => {
43+
if (app.mainWindow.isMinimized()) {
44+
app.mainWindow.restore();
45+
}
3946
app.mainWindow.show();
47+
app.mainWindow.focus();
4048
});
4149

4250
if (process.platform === 'darwin') {

src/stores/AppStore.js

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import { URL } from 'url';
1212
import Store from './lib/Store';
1313
import Request from './lib/Request';
1414
import { CHECK_INTERVAL, DEFAULT_APP_SETTINGS } from '../config';
15-
import { isMac, isLinux, isWindows } from '../environment';
15+
import { isMac } from '../environment';
1616
import locales from '../i18n/translations';
1717
import { gaEvent, gaPage } from '../lib/analytics';
1818
import { onVisibilityChange } from '../helpers/visibility-helper';
@@ -195,12 +195,11 @@ export default class AppStore extends Store {
195195
});
196196

197197
this.actions.service.setActive({ serviceId });
198-
199-
if (isWindows) {
198+
mainWindow.show();
199+
if (app.mainWindow.isMinimized()) {
200200
mainWindow.restore();
201-
} else if (isLinux) {
202-
mainWindow.show();
203201
}
202+
mainWindow.focus();
204203
}
205204
};
206205
}

0 commit comments

Comments
 (0)