From 11a23cfc46b801aedce7d389beaec3997cdf5a73 Mon Sep 17 00:00:00 2001 From: Stefan Date: Thu, 2 Nov 2017 23:10:34 +0100 Subject: Test window.show instead of restore --- src/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/index.js b/src/index.js index 030736fee..361ad59db 100644 --- a/src/index.js +++ b/src/index.js @@ -32,7 +32,7 @@ if (isWindows) { if (process.platform !== 'darwin') { const isSecondInstance = app.makeSingleInstance(() => { if (mainWindow) { - if (mainWindow.isMinimized()) mainWindow.restore(); + if (mainWindow.isMinimized()) mainWindow.show(); mainWindow.focus(); } }); -- cgit v1.2.3-70-g09d2 From 28e993ee7cdf35019919d14b24408dd42979d8a7 Mon Sep 17 00:00:00 2001 From: Stefan Malzner Date: Fri, 3 Nov 2017 00:15:43 +0100 Subject: Start from pinned icon --- package.json | 1 - src/index.js | 9 +++------ 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/package.json b/package.json index dcb05bf6a..56c02ddf2 100644 --- a/package.json +++ b/package.json @@ -32,7 +32,6 @@ "classnames": "^2.2.5", "electron-fetch": "^1.1.0", "electron-spellchecker": "^1.2.0", - "electron-squirrel-startup": "^1.0.0", "electron-updater": "^2.4.3", "electron-window-state": "^4.1.0", "fs-extra": "^3.0.1", diff --git a/src/index.js b/src/index.js index 361ad59db..a6c7e1d85 100644 --- a/src/index.js +++ b/src/index.js @@ -2,18 +2,14 @@ import { app, BrowserWindow, shell } from 'electron'; import fs from 'fs-extra'; import path from 'path'; -/* eslint-disable */ -if (require('electron-squirrel-startup')) app.quit(); - import windowStateKeeper from 'electron-window-state'; import { isDevMode, isWindows } from './environment'; import ipcApi from './electron/ipc-api'; import Tray from './lib/Tray'; import Settings from './electron/Settings'; -import { appId } from './package.json'; +import { appId } from './package.json'; // eslint-disable-line import/no-unresolved import './electron/exception'; -/* eslint-enable */ // Keep a global reference of the window object, if you don't, the window will // be closed automatically when the JavaScript object is garbage collected. @@ -32,9 +28,10 @@ if (isWindows) { if (process.platform !== 'darwin') { const isSecondInstance = app.makeSingleInstance(() => { if (mainWindow) { - if (mainWindow.isMinimized()) mainWindow.show(); + if (mainWindow.isMinimized()) mainWindow.restore(); mainWindow.focus(); } + return true; }); if (isSecondInstance) { -- cgit v1.2.3-70-g09d2 From 777814aa713e5093de52cb9c4c1cbf754b9e8289 Mon Sep 17 00:00:00 2001 From: Stefan Date: Fri, 3 Nov 2017 10:27:14 +0100 Subject: fix(Windows): Open Window when app is pinned to taskbar and minimized to system tray --- src/index.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/index.js b/src/index.js index a6c7e1d85..a72d76f3a 100644 --- a/src/index.js +++ b/src/index.js @@ -31,7 +31,6 @@ if (process.platform !== 'darwin') { if (mainWindow.isMinimized()) mainWindow.restore(); mainWindow.focus(); } - return true; }); if (isSecondInstance) { @@ -111,6 +110,13 @@ const createWindow = async () => { app.isMaximized = true; }); + mainWindow.on('close', (e) => { + if (settings.get('minimizeToSystemTray')) { + e.preventDefault(); + mainWindow.minimize(); + } + }); + mainWindow.on('unmaximize', () => { app.isMaximized = false; }); -- cgit v1.2.3-70-g09d2