Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[keybinding] Align 'Open Preferences' and 'Save As' keybindings with VS Code on Mac OS #6620

Merged
merged 2 commits into from
Nov 25, 2019

Conversation

jankeromnes
Copy link
Member

@jankeromnes jankeromnes commented Nov 25, 2019

Fixes #6606.

What it does

In VS Code, the default keybinding to open Settings is:

  • Cmd + , on Mac OS, and
  • Ctrl + , on Linux and Windows

In Theia, it is currently Ctrl + , everywhere. While this works everywhere, it's perceived as surprising on Mac OS.

Thus, on Mac OS we want the default keybinding to be Cmd + ,. However:

  • The previous keybinding should still work, in order to avoid nasty surprises for users who got used to it
  • While the new keybinding works in Electron and in browser/Chrome, it doesn't work in browser/Firefox. So on Firefox Mac, the default keybinding should remain Ctrl + ,

How to test

  • In Electron and in Chrome:
    • both Ctrl + , and Ctrl + , should open the Preferences
    • the menu entry File > Settings > Open Preferences should show ⌘, as the default keybinding
  • In Firefox:
    • only Ctrl + , can open the Preferences
    • thus the menu entry should still show ^, as the default keybinding
  • On Linux and Windows:
    • the default keybinding should remain Ctrl + , everywhere (like VS Code)

Review checklist

Reminder for reviewers

@jankeromnes
Copy link
Member Author

Signed off and added CHANGELOG.md entry.

…n Mac OS (except in Firefox)

Signed-off-by: Jan Keromnes <jan.keromnes@typefox.io>
Copy link
Contributor

@svenefftinge svenefftinge left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Signed-off-by: Jan Keromnes <jan.keromnes@typefox.io>
@jankeromnes
Copy link
Member Author

Thanks a lot @svenefftinge! I also threw in Save As, because it was a really small change (ctrl+shift+s to ctrlcmd+shift+s, works well in Electron + Firefox + Chrome).

@jankeromnes jankeromnes changed the title [keybinding] Make "⌘," the default keybinding to "Open Preferences" on Mac OS (except in Firefox) [keybinding] Align 'Open Preferences' and 'Save As' keybindings with VS Code on Mac OS Nov 25, 2019
@jankeromnes
Copy link
Member Author

All green!

@svenefftinge or @akosyakov, please merge this PR for me, as I'm not yet a committer.

command: CommonCommands.OPEN_PREFERENCES.id,
keybinding: 'cmd+,'
});
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should not be else here?

Copy link
Member Author

@jankeromnes jankeromnes Nov 25, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is intended: E.g. on Mac OS, in Chrome or Electron, we'll register both cmd+, and ctrl+,:

  • cmd+, is the new default keybinding, while
  • ctrl+, is there for people who already got used to typing ctrl+, for Preferences on Mac OS

Side note: In the File > Settings > Open Preferences menu entry, only the first keybinding shows up. (I double-checked that both keybindings work as expected, but that only the first is shown in the menu.)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI: this change will disable the default Chrome binding for opening Chrome preferences on macOS. Was it on purpose?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, in order to follow VS Code's convention, we'd like to replace the behavior of cmd+, in browsers. (This only works in Chrome though -- Firefox will continue to open browser preferences, which is why we set a different default keybinding there).

Would you be surprised that hitting cmd+, in Theia in Chrome now opens the Theia preferences and no longer the Chrome preferences?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought we follow VS Code's convention in electron only and not disable/override the browser bindings.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point. My understanding was that we try to follow VS Code's convention everywhere, but that in some browsers, it's sometimes impossible to override browser bindings (e.g. it's impossible to override cmd+, in Firefox) in which case we fall back on alternative bindings, but I may be wrong.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we try to follow VS Code's convention everywhere

I thought, no. My understanding was the following; we mimic the VS Code keymap in electron and leave the rest as is. For instance, why would we ever distinguish between macOS and other platforms when using Gitpod in Chrome.

CC: @svenefftinge

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Keybindings are part of a user's muscle memory. So we want to meet expectations as much as possible. I.e. the only reason to diverge from the default keybindings from VS Code (resp. keymaps like emacs or vim) is that browsers hinder us from handling certain keybindings.
Since CMD+, works in Chrome it should be used.

@svenefftinge svenefftinge merged commit 98ac397 into eclipse-theia:master Nov 25, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[keybinding] wrong keybinding for "Open Preferences" on Mac (Electron): should be Cmd+, not Ctrl+,
4 participants