-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
Support remapping keybindings #748
Conversation
Instead iterate over the action names, then serialize in that order, so it's sane.
This fixes #537
is now a good time to split the "key bindings" model from the key bindings magic? I'm concerned that the KeyBindings/AppKeyBindings object has a little too much power. Right now, it's responsible for:
Should those last two live somewhere else? |
Everytime a new keybinding is added to the app, an entry for a customised keybinding should be added to the docs and to the profile.json file (commented out until the user wishes to change it from the default) This way all keybindings are discoverable. |
@DHowett-MSFT I'm not sure if I totally get what you're saying - seems to me like you're proposing a separate I'm not really strongly opposed to that, but I'm not really sure what extra benefit we'd get from that. To me it seems like the serialization of the bindings is pretty tightly coupled to the actual implementation of having a map of keychord->action pairs. Also, iirc bullet point 3 is actually handled by |
{ | ||
modifiers |= KeyModifiers::Alt; | ||
} | ||
else if (part == SHIFT_KEY) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we have to worry about left-shift vs right-shift? Do we want to?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We recently learned that right alt is altgr sometimes?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is true, but I'm not sure UWP can differentiate between the two in the KeyEvent. I'm pretty sure there's only a Ctrl, Shift, and Alt, and not a left/right version :/
If we find out otherwise, then the entire KeyModifiers structure might need to be updated, as well as any consumers.
// If we weren't able to find a match, throw an exception. | ||
if (!foundKey) | ||
{ | ||
throw hresult_invalid_argument(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we also want an error dialogue box like in #622? Or maybe just ignore it? I'm ok with this behavior for now but we should probably decide on behavior and file it as a separate issue for after.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yea probably, but I'll make that a separate task for once both this and 622 are merged.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here's a concern: should not being able to deserialize a single key binding blast the entire profiles into outer space? even with an error message, that sucks
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yea, I don't think it should. I'd think that failing to parse a single key would still ignore the bad binding, but display the error (somehow)
…dings # Conflicts: # src/cascadia/TerminalApp/AppKeyBindings.cpp
* Update the appkeybindings vector to a map * Update the strings to wchar_t*'s to avoid ctoring a ton on startup
// If we weren't able to find a match, throw an exception. | ||
if (!foundKey) | ||
{ | ||
throw hresult_invalid_argument(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here's a concern: should not being able to deserialize a single key binding blast the entire profiles into outer space? even with an error message, that sucks
More to the point about idl, my concern is that key binding serialization lives in a totally different component than settings serialization now.. hmm. Is this something we can reconcile? |
@DHowett-MSFT great point on that. The The AppKeyBindings is actually an App component, so it makes sense to couple it's serialization directly to it's class, just like profiles, globals and schemes. |
* flip the names, actions map around
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems mostly reasonable to me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Though, we changed +
to plus
, but -
.
,
are still symbolic. someone in the future might bind ctrl+-
and ctrl+plus
as zoom out
and zoom in
respectively, and that seems unsymmetric
Was looking at this in conjunction with resolving suggestions for #805. The XAML framework uses |
…dings # Conflicts: # src/cascadia/TerminalApp/AppKeyBindings.cpp
@DHowett-MSFT is CLA bot acting up? Can we manually trigger it somehow? Looks like it's broken on #710 too |
Fixes #537.
Adds support for remappable keybindings in the profiles.json file. The keybindings look like the following: