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

Figure out how to support bindings for "VK_OEM" keys #1212

Closed
DHowett-MSFT opened this issue Jun 12, 2019 · 6 comments · Fixed by #2067
Closed

Figure out how to support bindings for "VK_OEM" keys #1212

DHowett-MSFT opened this issue Jun 12, 2019 · 6 comments · Fixed by #2067
Assignees
Labels
Area-Settings Issues related to settings and customizability, for console or terminal Issue-Task It's a feature request, but it doesn't really need a major design. Needs-Tag-Fix Doesn't match tag requirements Product-Terminal The new Windows Terminal. Resolution-Fix-Committed Fix is checked in, but it might be 3-4 weeks until a release.
Milestone

Comments

@DHowett-MSFT
Copy link
Contributor

// TODO:
// These all look like they'd be good keybindings, but change based on keyboard
// layout. How do we deal with that?
// #define VK_OEM_NEC_EQUAL 0x92 // '=' key on numpad
// #define VK_OEM_1 0xBA // ';:' for US
// #define VK_OEM_2 0xBF // '/?' for US
// #define VK_OEM_3 0xC0 // '`~' for US
// #define VK_OEM_4 0xDB // '[{' for US
// #define VK_OEM_5 0xDC // '\|' for US
// #define VK_OEM_6 0xDD // ']}' for US
// #define VK_OEM_7 0xDE // ''"' for US

@DHowett-MSFT DHowett-MSFT added Help Wanted We encourage anyone to jump in on these. Area-Settings Issues related to settings and customizability, for console or terminal Product-Terminal The new Windows Terminal. Issue-Task It's a feature request, but it doesn't really need a major design. labels Jun 12, 2019
@DHowett-MSFT DHowett-MSFT added this to the Terminal v1.0 milestone Jun 12, 2019
@ghost ghost added the Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting label Jun 12, 2019
@DHowett-MSFT DHowett-MSFT removed the Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting label Jun 12, 2019
@DHowett-MSFT
Copy link
Contributor Author

Yanking the triage tag. This is a TODO from code.

@shanselman
Copy link
Member

I’m looking to have CTRL+| (which is ctrl shift \ on my keyboard) split vertical. Not possible today.

For horizontal I’m using CTRL+SHIFT+- which is CTRL+_

FYI+context

@timheuer
Copy link
Member

One way maybe to be able to handle this would be to allow VK_** int values to be used in the binding 'language' to avoid a bunch of hard coding of VK and missing ones. enables you to you say "ctrl+(vk)32" ? -- just a wild idea.

I think in @shanselman use case, supporting a keybinding that already involves a modifier might be tough (I don't see cmder/conemu handle this either). But even supporting CTRL+\ (the non-shifted pipe character that maps to VK_SEPARATOR) doesn't work right now.

@zadjii-msft
Copy link
Member

I'd really love it if there was a way that we could just take a character and get the vkey from it. That way, if a user put ctrl+| in their json, we'd try to find the key from the char in our map, fail, then ask the OS what vkey that should be. We'd look up what the actual vkey is, find VK_OEM_5, Shift, and use that key+modifiers at runtime. There's a pretty good chance there's a relative of MapVirtualKey that might work for that purpose. However, we'd need to make sure that when we re-serialize the key, that we don't lose the original. (granted, that would be fixed by #754, so maybe we should do that one first or just live with it for now...)

@binarycrusader
Copy link
Member

binarycrusader commented Jun 14, 2019

I'd really love it if there was a way that we could just take a character and get the vkey from it.

I think this is what you're looking for in this case:

https://docs.microsoft.com/en-us/windows/desktop/api/winuser/nf-winuser-oemkeyscan

And then for keys on the "Main" keyboard, there's also:

https://docs.microsoft.com/en-us/windows/desktop/api/winuser/nf-winuser-vkkeyscanexa

DHowett-MSFT pushed a commit that referenced this issue Jul 23, 2019
This commit introduces support for key bindings containing keys
traditionally classified as "OEM" keys. It uses VkKeyScanW and
MapVirtualKeyW, and translates the modifiers that come out of
VkKeyScanW to key chord modifiers.

The net result of this is that you can use bindings like "ctrl+|" in
your settings. That one in particular will be reserialized (and
displayed in any menus) as "ctrl+shift+\". Admittedly, this is not
clear, but it _is_ the truest representation of the key.

This commit also moves the Xaml key chord name override generator into
App as a static function, *AND* it forces its use for all modifier
names. This will present a localization issue, which will be helped in
part by #1972. This is required to work around
microsoft/microsoft-ui-xaml#708. I've kept the original code around
guarded by a puzzling ifdef, because it absolutely has value.

Fixes #1212.
DHowett-MSFT pushed a commit that referenced this issue Jul 23, 2019
This commit introduces support for key bindings containing keys
traditionally classified as "OEM" keys. It uses VkKeyScanW and
MapVirtualKeyW, and translates the modifiers that come out of
VkKeyScanW to key chord modifiers.

The net result of this is that you can use bindings like "ctrl+|" in
your settings. That one in particular will be reserialized (and
displayed in any menus) as "ctrl+shift+\". Admittedly, this is not
clear, but it _is_ the truest representation of the key.

This commit also moves the Xaml key chord name override generator into
App as a static function, *AND* it forces its use for all modifier
names. This will present a localization issue, which will be helped in
part by #1972. This is required to work around
microsoft/microsoft-ui-xaml#708. I've kept the original code around
guarded by a puzzling ifdef, because it absolutely has value.

Fixes #1212.
@ghost ghost added the In-PR This issue has a related PR label Jul 23, 2019
@DHowett-MSFT DHowett-MSFT removed the Help Wanted We encourage anyone to jump in on these. label Jul 23, 2019
@ghost ghost added Needs-Tag-Fix Doesn't match tag requirements Resolution-Fix-Committed Fix is checked in, but it might be 3-4 weeks until a release. and removed In-PR This issue has a related PR labels Jul 23, 2019
DHowett-MSFT pushed a commit that referenced this issue Jul 23, 2019
This commit introduces support for key bindings containing keys
traditionally classified as "OEM" keys. It uses VkKeyScanW and
MapVirtualKeyW, and translates the modifiers that come out of
VkKeyScanW to key chord modifiers.

The net result of this is that you can use bindings like "ctrl+|" in
your settings. That one in particular will be reserialized (and
displayed in any menus) as "ctrl+shift+\". Admittedly, this is not
clear, but it _is_ the truest representation of the key.

This commit also moves the Xaml key chord name override generator into
App as a static function, *AND* it forces its use for all modifier
names. This will present a localization issue, which will be helped in
part by #1972. This is required to work around
microsoft/microsoft-ui-xaml#708. I've kept the original code around
guarded by a puzzling ifdef, because it absolutely has value.

Fixes #1212.
@ghost
Copy link

ghost commented Aug 3, 2019

🎉This issue was addressed in #2067, which has now been successfully released as Windows Terminal Preview v0.3.2142.0.:tada:

Handy links:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Settings Issues related to settings and customizability, for console or terminal Issue-Task It's a feature request, but it doesn't really need a major design. Needs-Tag-Fix Doesn't match tag requirements Product-Terminal The new Windows Terminal. Resolution-Fix-Committed Fix is checked in, but it might be 3-4 weeks until a release.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants