Last active
November 7, 2015 09:53
-
-
Save fukayatsu/c3b74f2864e7e950ff76 to your computer and use it in GitHub Desktop.
atomのterminal-plusでfocusをいい感じにtoggleするやつ
This file contains 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
focusMain = (e) -> | |
atom.workspace.getActivePane().activate() | |
for panel in atom.workspace.getBottomPanels() | |
if panel.item[0]?.className == 'terminal-plus terminal-view' | |
panel.item.terminal?.blur() | |
focusTerminal = (e) -> | |
terminalFound = false | |
for panel in atom.workspace.getBottomPanels() | |
if panel.item[0]?.className == 'terminal-plus terminal-view' | |
terminalFound = true | |
if panel.isVisible() | |
panel.item.focusTerminal() | |
else | |
panel.item.toggle() | |
unless terminalFound | |
for panel in atom.workspace.getBottomPanels() | |
if panel.item[0]?.className == 'terminal-plus status-bar' | |
panel.item.toggle() | |
atom.commands.add 'atom-workspace', | |
'editor:focus-main': focusMain | |
'editor:focus-terminal': focusTerminal | |
'editor:toggle-focus-terminal': -> | |
if document.activeElement.className == 'terminal' | |
focusMain() | |
else | |
focusTerminal() |
This file contains 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
'.workspace': | |
'cmd-;': 'editor:toggle-focus-terminal' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment