From b4dda021b1c7ac56678db7a608fc0ed34824acdf Mon Sep 17 00:00:00 2001 From: Ben Gotow Date: Tue, 1 Dec 2015 14:46:08 -0800 Subject: [PATCH] fix(tray): On Win32 / Linux click should open main window if closed --- internal_packages/system-tray/lib/system-tray.es6 | 4 ++-- src/nylas-env.coffee | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/internal_packages/system-tray/lib/system-tray.es6 b/internal_packages/system-tray/lib/system-tray.es6 index 9bafd7e32..b371bb3b5 100644 --- a/internal_packages/system-tray/lib/system-tray.es6 +++ b/internal_packages/system-tray/lib/system-tray.es6 @@ -1,4 +1,4 @@ -import remote from 'remote'; +import {remote, ipcRenderer} from 'electron'; import TrayStore from './tray-store'; const Tray = remote.require('tray'); @@ -29,7 +29,7 @@ class SystemTray { _onClicked() { if (this._platform !== 'darwin') { - NylasEnv.focus(); + ipcRenderer.send('command', 'application:show-main-window'); } } diff --git a/src/nylas-env.coffee b/src/nylas-env.coffee index a796162a1..3c15380d6 100644 --- a/src/nylas-env.coffee +++ b/src/nylas-env.coffee @@ -500,7 +500,8 @@ class NylasEnvConstructor extends Model center: -> ipcRenderer.send('call-window-method', 'center') - # Extended: Focus the current window. + # Extended: Focus the current window. Note: this will not open the window + # if it is hidden. focus: -> ipcRenderer.send('call-window-method', 'focus') window.focus()