Focus atom-text-editor after tree-view:toggle-focus


#1

Hello everyone.

I’m trying to add simple keybinding that will:

  • focus TreeView
  • create new folder
  • return focus to TextEditor

Right now I’m trying to add something like this to init.coffee

atom.commands.add 'atom-workspace', 'my-commands:toggle-tree-view', -> work = atom.views.getView(atom.workspace) atom.commands.dispatch work, 'tree-view:toggle-focus' atom.commands.dispatch work, 'tree-view:add-folder' atom.workspace.panelContainers.modal.onDidRemovePanel -> atom.commands.dispatch work, 'tree-view:toggle-focus' console.log 'lol';

Focus on TreeView works, create new folder too. The problem is with the focus back to the TextEditor. The console.log is running, but the focus stays on TreeView.

How to fix that?


#2

Instead of doing all this through the GUI, you could do:

fs = require 'fs'
fs.mkdirSync('/path/to/create')

#3

That’s not the answer. I want to use GUI.