Last active
November 23, 2015 22:49
-
-
Save ylixir/1aa395d09d9cde0aff98 to your computer and use it in GitHub Desktop.
Focus follows mouse for Atom editor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Focus Follows Mouse | |
# ----------------------------------------- | |
# put this in init.coffee | |
focusPane = (item) -> | |
item.activate() | |
try | |
item.activeItem.focusTerm() | |
catch err | |
console.log(err) | |
followMouse = (item) -> | |
elem = atom.views.getView(item) | |
elem.addEventListener('mouseenter', (-> focusPane item)) | |
# Create for additional panes as they are added | |
handlePaneFocus = (e) -> | |
followMouse(e.pane) | |
atom.workspace.onDidAddPane(handlePaneFocus) | |
# set it up for initial panes | |
for p in atom.workspace.getPanes() | |
followMouse p |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment