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.
This commit is contained in:
Nathan Sobo
2014-09-25 11:56:29 -06:00
parent 670f3e4946
commit 187e300167

View File

@@ -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)