Keyboard Keybindings – How to Map \UA Using DefaultKeyBinding.dict

keybindingskeyboard

I am using a german Windows keyboard and want to map the key with <>| on it to actually really write these symbols. Currently it writes

<>| without modifier:        ^
<>| with option key:         „
<>| with command or control: nothing 

Using the app Key codesI figured out that <>| has a unicode of 0xA, so I tried these mappings in my DefaultKeyBinding.dict:

"\UA" = ("insertText:", "<");  // forgot what this becomes
"$\UA" = ("insertText:", ">"); // becomes ° instead of <
"~\UA" = ("insertText:", "|"); // becomes „ instead of |

I commented right next to it what's the result after of course logging out and logging in again. Other key mappings work fine, I even disabled them during testing to make sure there are no conflicts.

Can anyone help me with this? What am I doing wrong? Is there any way to debug this?

Note: The key I am talking about can be seen here: https://en.wikipedia.org/wiki/German_keyboard_layout#/media/File:KB_Germany.svg It is the key over the left windows key.

Update:
I think I found one part of the issue: I confused unicode code and key code. MacOS expects the unicode code, I gave the key code. The problem I have is that the Key Codes app gives no unicode code for the key with <>| on it, only a key code (0xA -> \UA in DefaultKeyBinding.dict)

Update2:
found the solution, see my answer below.

Best Answer

An easy alternative is to make a custom layout with Ukelele. See if this one does what you need.