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


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

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?


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

fs = require 'fs'


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