atom / github

:octocat: Git and GitHub integration for Atom
https://github.atom.io
MIT License
1.11k stars 392 forks source link

Close Git and GitHub tabs on toggle-git-tab-focus and toggle-github-tab-focus #874

Open smashwilson opened 7 years ago

smashwilson commented 7 years ago

With the latest toggle and focus event work in #777, invoking github:toggle-git-tab-focus or github:toggle-git-tab-focus while the appropriate tab is already open and focused blurs the tab but leaves it open. In Slack the other day, @jasonrudolph brought up that it isn't often that useful to keep the tab open once you finish whatever operation you popped it open to accomplish, and in fact he'd gone so far as to make a custom keybinding to dismiss it entirely with actrl-9 to better fit the common workflow.

On the other hand, for the GitHub tab and the Tree View both do have value to be left open when blurred, and there's value in keeping consistency in behavior across all of our ctrl-# and ctrl-shift-# bindings.

/cc @jasonrudolph @nathansobo

smashwilson commented 7 years ago

Here are the full list of scenarios we need consistent behavior for:

Where visible means "the DockItem is rendered in a Dock and that Dock is expanded" and # means "0" for the tree-view, "8" for the GitHub tab, or "9" for the Git tab.

/xref #174 for prior discussions.

smashwilson commented 7 years ago

Here's what I'm thinking right now based on your feedback:

jasonrudolph commented 7 years ago

Here's what I'm thinking right now based on your feedback:

  • ctrl-# ...
  • ctrl-shift-# ...

:+1::heart_eyes_cat:

  • esc aka tool-panel:unfocus
    • ... when the tab is visible and focused: focus the workspace center

I think that makes sense for the tree-view. I wonder if we can say that it will always make sense for everything that we put in a dock. For example, imagine that we put the UI for creating a git branch inside the dock instead of inside the status bar. If I start typing a new branch name, and then hit escape, I'd want Atom to cancel the branch creation and probably hide that form field, but I'm not sure whether I'd want the git dock to entirely lose focus. Admittedly, this is hypothetical at this point, but I wanted to offer it up as food for thought.

simurai commented 7 years ago
  • esc aka tool-panel:unfocus
    • ... when the tab is visible and focused: focus the workspace center I wonder if we can say that it will always make sense for everything that we put in a dock.

Find And Replace uses esc to close the panel. It isn't a dock item, but still kinda feels like one. What about:

ctrl-shift-#
-  ... when the tab is visible and focused: close the tab
+  ... when the tab is visible and focused: focus the workspace center

We could still use esc for moving focus back or closing the tab, but it wouldn't be the only way and can later be used for canceling something or clear a filter in an input.

I'm in the "only open panels when needed and close when done" camp, so I like this proposal. But for people that like to keep their panels open all the time, it probably does feel a bit odd, using ctrl-# to focus, but then having to use ctrl-shift-# to move the focus back to the center. 🤔

smashwilson commented 7 years ago
ctrl-shift-#
-  ... when the tab is visible and focused: close the tab
+  ... when the tab is visible and focused: focus the workspace center

That feels weird to me. I'm not sure how we'd express what ctrl-shift-# does in a succinct way there? Especially given the ... when the tab is visible, but unfocused: close the tab bit. In the original proposal ctrl-shift-# means "toggle visibility (never touch focus)" while ctrl-# is "focus it or close it".

Maybe we just need to introduce a Workspace keybinding in Atom proper for "focus the workspace center"? That way we wouldn't need to overload esc too much or worry about consistency among all of our panels and dock items.

But for people that like to keep their panels open all the time, it probably does feel a bit odd, using ctrl-# to focus, but then having to use ctrl-shift-# to move the focus back to the center. 🤔

Yeah, I feel like there isn't a good way to avoid asymmetry for somebody here...

simurai commented 7 years ago

Maybe we just need to introduce a Workspace keybinding in Atom proper for "focus the workspace center"?

💯 Yessssssss.. this sounds super handy. There are probably lots of packages that don't offer a way to "move focus back to the center".

Plus also a "close active dock item"? Because then I wonder if I would switch from toggling dock items to close all dock items with the same keybinding. That might feel nice because you don't have to think anymore which number you have to press. Especially if we keep adding more. I'll see if I can test that out.