[PR #2067] Allow the mapping of OEM keys ({}|\<>/_-=+) in key bindings #24790

Open
opened 2026-01-31 09:05:21 +00:00 by claunia · 0 comments
Owner

Original Pull Request: https://github.com/microsoft/terminal/pull/2067

State: closed
Merged: Yes


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.

image

Renormalization

input reserialized as
"alt+=" "alt+plus"
"alt+:" "alt+shift+;"
"ctrl+?" "ctrl+shift+/"
"shift+~" "shift+<backtick>"
(markdown limitation)
"alt+}" "alt+shift+]"
"ctrl+alt+<pipe>" "ctrl+alt+shift+\\"
"shift+\"" "shift+'"
"alt+," "alt+,"
"ctrl+-" "ctrl+-"
"shift+." "shift+."

PR Checklist

Validation Steps Performed

Manual

**Original Pull Request:** https://github.com/microsoft/terminal/pull/2067 **State:** closed **Merged:** Yes --- 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. ![image](https://user-images.githubusercontent.com/14316954/61683890-22489a00-accc-11e9-8fa2-88869043ac4a.png) ### Renormalization | input | reserialized as | |-|-| | `"alt+="` | `"alt+plus"` | | `"alt+:"` | `"alt+shift+;"` | | `"ctrl+?"` | `"ctrl+shift+/"` | | `"shift+~"` | `"shift+<backtick>"`<br>_(markdown limitation)_ | | `"alt+}"` | `"alt+shift+]"` | | `"ctrl+alt+<pipe>"` | `"ctrl+alt+shift+\\"` | | `"shift+\""` | `"shift+'"` | | `"alt+,"` | `"alt+,"` | | `"ctrl+-"` | `"ctrl+-"` | | `"shift+."` | `"shift+."` | <!-- Please review the items on the PR checklist before submitting--> ## PR Checklist * [x] Closes #1212 * [x] CLA signed. If not, go over [here](https://cla.opensource.microsoft.com/microsoft/Terminal) and sign the CLA * [x] I've discussed this with core contributors already. ## Validation Steps Performed Manual
claunia added the pull-request label 2026-01-31 09:05:21 +00:00
Sign in to join this conversation.
No Label pull-request
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#24790