-
Notifications
You must be signed in to change notification settings - Fork 168
Mac-only keyboard shortcut #438
Comments
The platform-specific keys are chosen during the normalization process: phosphor/packages/commands/src/index.ts Line 1323 in 7a87d35
So your second example should work. Note that the keybinding keys become the phosphor/packages/commands/src/index.ts Line 1357 in 7a87d35
|
No, it would make it a compile error if you have |
Touché |
Phosphor allows shortcuts to be empty, and it’s the only way to have platform-specific shortcuts (define keys to be [], and the platform keys to be something specific). See phosphorjs/phosphor#438 for some discussion.
I realized it's our fault in jlab that it won't work - we insist that keybindings have at least one item in them in our json schema. I've put in a PR fixing this: jupyterlab/jupyterlab#7335 |
Chris, I think my questions are answered except the above one. What do you think about invalidating the entire keybinding if it contains Cmd on a non-mac platform. Otherwise you end up having bindings on non-mac platforms that you wouldn't didn't expect, or at least I wouldn't expect. |
@sccolbert That's a WIP for 2.0. Should we wait for #417, or go ahead with jupyterlab/jupyterlab#7002 ? |
@jasongrout By |
Ignore is probably most convenient to the end-user for me. Then the person registering the binding doesn't have to check to see if they are on a mac. I mean, clearly the keybinding won't be triggered on windows, so they won't even notice it's not there. |
Ignoring it sounds reasonable. Technically its a behavioral change, not an API change. Could probably be considered a bugfix. |
I'd like to create a keybinding that only works on macs. Intuitively, I might imagine something like
but I think that won't work in the current code (we assume keys is an array throughout the code, and this would make it undefined on non-Mac platforms). I could do this:
but that assumes that the matching function at
phosphor/packages/commands/src/index.ts
Lines 1356 to 1369 in 7a87d35
Note that I can't do
because this would be translated to "Shift ." on non-mac platforms, which is not intuitive to me. I think the current behavior of ignoring Cmd on non-mac platforms should be changed to invalidating a keybinding if it contains Cmd on a non-mac platform.
The text was updated successfully, but these errors were encountered: