From 187e30016799e6d4ea01a12c01d6fbfe59baae57 Mon Sep 17 00:00:00 2001 From: Nathan Sobo Date: Thu, 25 Sep 2014 11:56:29 -0600 Subject: [PATCH] Apply workaround for clearing of focus upon loading of window After the first window focus event, the focus is getting cleared back to document.body regardless of the prior active element. Refocusing workspace on a delay after the first window focus event works around the problem. --- src/window-bootstrap.coffee | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/window-bootstrap.coffee b/src/window-bootstrap.coffee index 42ec7cd91..1d10628e0 100644 --- a/src/window-bootstrap.coffee +++ b/src/window-bootstrap.coffee @@ -9,3 +9,9 @@ atom.initialize() atom.startEditorWindow() window.atom.loadTime = Date.now() - startTime console.log "Window load time: #{atom.getWindowLoadTime()}ms" + +# Workaround for focus getting cleared upon window creation +windowFocused = (e) -> + window.removeEventListener('focus', windowFocused) + setTimeout (-> document.querySelector('.workspace').focus()), 0 +window.addEventListener('focus', windowFocused)