2

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,

  • I suggest you to try Karabiner Elements for this. Otherwise Karabiner Event Viewer gives me the code 53 for tilde on both internal US Apple keyboard as well as external. Can't say if it's decimal or hex value. – modlin Feb 15 at 15:26
  • @modlin - I think 53 is decimal. 53 is equal to 0x35 which the technical note in the question says is "Grave Accent and Tilde". However 0x35 maps to > 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. – lx07 Feb 15 at 16:15
  • Use xev to find out what (decimal) scan code is being sent by the key, then remap it. See: apple.stackexchange.com/a/317556/119271 – Allan Feb 15 at 17:59
  • @Allan - that doesn't work for me with AZERTY keyboard. xev 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. – lx07 Feb 15 at 19:30
  • I had to look up the document in question (I'm not at home so I don't have the link handy), but the tech note is from USB.org. If memory serves, the HID standard is that the scan codes are all the same and the changes are made in software (i.e. localizations, QWERTY vs. AZERTY vs DVORAK). So the code where your "A" is on AZERTY will be the same code on QWERTY. – Allan Feb 15 at 19:46
0

So i thought I tried 35, but i guess i missed it.

The `~ key is 35.

So just to be clear this [technical note] Has everything correct however i was confused by the non-Us keyboard vs graveaccent/Tilde names.

~ key is 35

\| key is 31 and 32 (for us keyboards)

|improve this answer|||||

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .