mehcode / atom-project-plus

Simply awesome project management in Atom.
https://atom.io/packages/project-plus
MIT License
99 stars 18 forks source link

No focus when switching projects #104

Open jpmvferreira opened 5 years ago

jpmvferreira commented 5 years ago

Hi there,

I've noticed a small issue in the way the package behaves when switching projects (i wouldn't call it a bug), but whenever i switch from a project to another, not only the tree-view expands (which might be intended) but there is no focus on either the editor nor the editor, which is annoying when you are in a keyboard-driven system.

Because of that, i'm here to suggest a few features (customizable if possible) i haven't seen being suggested:

Personally for me the first one is the most important one, has i can close the tree-view with shortcut, but right after switching project my first instinct is to start typing or changing tabs, only to find out that there is no focus on either editor or tree-view, so i must use Alt+/ to gain focus on tree-view, and use it again when switching focus to editor.

This isn't game breaking, it's just something that would add a little convenience and probably didn't deserve such an extensive thread.

I also noticed this issue - sorry i don't know how to redirect issues - that claims to have fixed this losing focus behavior, but i still have it.

System Specs:

jpmvferreira commented 5 years ago

I'm trying to create a workaround for this issue, and i begin by writing my own custom keybind with the set of actions that can be used to regain focus on the editor after switching projects, however it's not working as expected, here's the init.js:

atom.commands.add('.platform-linux', 'custom:get-focus', function() {
  atom.commands.dispatch(atom.workspace.element, 'tree-view:toggle');
  atom.commands.dispatch(atom.workspace.element, 'tree-view:toggle');
  atom.commands.dispatch(atom.workspace.element, 'tree-view:toggle');
  atom.commands.dispatch(atom.workspace.element, 'tree-view:toggle-focus');
  })

I've tried several combinations of tree-view:toggle and tree-view:toggle-focus and none of them work.

If anybody could give me a hand here it would be really great!