From 84adfb3bdf0abc1314172260621c31f0440e8efd Mon Sep 17 00:00:00 2001 From: Juan Tejada Date: Sat, 28 Nov 2015 09:04:55 -0800 Subject: [PATCH] fix(prefs): Focus main window when open prefs and prevent dupe sheets - Fixes #498 - Fixes #484 --- internal_packages/preferences/lib/main.cjsx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/internal_packages/preferences/lib/main.cjsx b/internal_packages/preferences/lib/main.cjsx index b0b9c9521..bd805809f 100644 --- a/internal_packages/preferences/lib/main.cjsx +++ b/internal_packages/preferences/lib/main.cjsx @@ -2,11 +2,11 @@ Actions, WorkspaceStore, ComponentRegistry} = require 'nylas-exports' +{ipcRenderer} = require 'electron' module.exports = activate: -> - {ipcRenderer} = require 'electron' React = require 'react' Cfg = PreferencesSectionStore.SectionConfig @@ -45,7 +45,9 @@ module.exports = ipcRenderer.on 'open-preferences', => @_openPreferences() _openPreferences: -> - Actions.pushSheet(WorkspaceStore.Sheet.Preferences) + ipcRenderer.send 'command', 'application:show-main-window' + if WorkspaceStore.topSheet() isnt WorkspaceStore.Sheet.Preferences + Actions.pushSheet(WorkspaceStore.Sheet.Preferences) deactivate: ->