I want to map my esc key
to ~
tilde.
Using this reference: How do I remap a key in macOS Sierra, e.g., Right Alt to Right Control?
I found this technical note
Using this code:
hidutil property --set '{"UserKeyMapping":
[{"HIDKeyboardModifierMappingSrc":0x700000029,
"HIDKeyboardModifierMappingDst":0x700000032}]}'
The problem is the escape key outputs \|
and not ~
. I thought that maybe a typo resulted in the codes being swiched. so I also tried 0x31, 0x32, 0x33, 0x34, 0x35.
BOTH 0x32 and 0x31 result in \|
back slash char... Does anyone know the correct code to use for the tilde ~ key, that one you use to go to the home dir. Thanks
Edit: langue is US English, Mac OS 10.14,
>
for me while 0x32 maps to grave accent /£
. I have a French AZERTY keyboard which doesn't have a~
key at all (it is AltGr+N for me) so it is certainly important to know the keyboard language OP is using.xev
to find out what (decimal) scan code is being sent by the key, then remap it. See: apple.stackexchange.com/a/317556/119271xev
shows 53 for asciitilde (which I get by pressing Alt-Gr+N) same as @modlin got with Karibiner and same as the Technical Note in the question says. However when I map 0x35 to escape with hidutil it maps<
. This is the button to right of the LHS shift, where (and I'm sure it isn't a coincidence) the~
button is on a US keyboard. Unfortunately the links in the Apple Technical Note to usb.org documents seem to be dead.