Skip to content
Permalink
Browse files

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
  • Loading branch information...
skoruppa authored and adlk committed Mar 8, 2019
1 parent c62a6a6 commit 5b02c4d3304a570562d4dd089e46624a58697f1f
Showing with 16 additions and 6 deletions.
  1. +4 −1 src/index.js
  2. +8 −0 src/lib/Tray.js
  3. +4 −5 src/stores/AppStore.js
@@ -72,7 +72,10 @@ if (!gotTheLock) {
app.on('second-instance', (event, argv) => {
// Someone tried to run a second instance, we should focus our window.
if (mainWindow) {
if (mainWindow.isMinimized()) mainWindow.restore();
mainWindow.show();
if (mainWindow.isMinimized()) {
mainWindow.restore();
}
mainWindow.focus();

if (isWindows) {
@@ -22,7 +22,11 @@ export default class TrayIcon {
{
label: 'Show Franz',
click() {
if (app.mainWindow.isMinimized()) {
app.mainWindow.restore();
}
app.mainWindow.show();
app.mainWindow.focus();
},
}, {
label: 'Quit Franz',
@@ -36,7 +40,11 @@ export default class TrayIcon {
this.trayIcon.setContextMenu(trayMenu);

this.trayIcon.on('click', () => {
if (app.mainWindow.isMinimized()) {
app.mainWindow.restore();
}
app.mainWindow.show();
app.mainWindow.focus();
});

if (process.platform === 'darwin') {
@@ -12,7 +12,7 @@ import { URL } from 'url';
import Store from './lib/Store';
import Request from './lib/Request';
import { CHECK_INTERVAL, DEFAULT_APP_SETTINGS } from '../config';
import { isMac, isLinux, isWindows } from '../environment';
import { isMac } from '../environment';
import locales from '../i18n/translations';
import { gaEvent, gaPage } from '../lib/analytics';
import { onVisibilityChange } from '../helpers/visibility-helper';
@@ -195,12 +195,11 @@ export default class AppStore extends Store {
});

this.actions.service.setActive({ serviceId });

if (isWindows) {
mainWindow.show();
if (app.mainWindow.isMinimized()) {
mainWindow.restore();
} else if (isLinux) {
mainWindow.show();
}
mainWindow.focus();
}
};
}

0 comments on commit 5b02c4d

Please sign in to comment.
You can’t perform that action at this time.