From cb4d3f2e3956d53f226ac4d9fe959e4fec8ae213 Mon Sep 17 00:00:00 2001 From: Ben Gotow Date: Thu, 22 Oct 2015 16:02:25 -0700 Subject: [PATCH] fix(drafts): Reveal or focus windows for drafts when already open Fixes T3883 --- src/flux/stores/draft-store.coffee | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/flux/stores/draft-store.coffee b/src/flux/stores/draft-store.coffee index 199aac7d8..d9a79ebca 100644 --- a/src/flux/stores/draft-store.coffee +++ b/src/flux/stores/draft-store.coffee @@ -407,10 +407,16 @@ class DraftStore title = if options.newDraft then "New Message" else "Message" save.then => - atom.newWindow - title: title - windowType: "composer" - windowProps: _.extend(options, {draftClientId}) + app = require('remote').getGlobal('application') + existing = app.windowManager.windowWithPropsMatching({draftClientId}) + if existing + existing.restore() if existing.isMinimized() + existing.focus() + else + atom.newWindow + title: title + windowType: "composer" + windowProps: _.extend(options, {draftClientId}) _onHandleMailtoLink: (urlString) => account = AccountStore.current()