osx mavericks keyboard scancodes map to the same characters independent of language map

123 views Asked by At

In my user profile the keyboard types the same characters independent of the keyboard language setting.

Using this four key combinations always produce the same characters:

alt-7 {
alt-8 [
alt-9 ]
alt-0 }

My default Layout is German, so it should be | { } ≠

But even on an English and Neo Layout the key combinations produce the same four characters whether in the terminal or in any other native application. Using the on-screen-keyboard overview shows the same behaviour. I can see the Pipe character on the on-screen-keyboard but it types a curly bracket.

The only application that is rendering the correct characters is Intellij Idea. I'm suspecting it might be Java or Idea might just access the scancodes directly.

Another user account on the same machine does not show that behaviour (the keyboard renders the expected characters) so it must be something specific to my user profile.

I have done extensive google searching but what I could not find is how the mapping from scancodes to characters works in OSX on a user profile base.

Since being able to type the '|' character is crucial for me I would greatly appreciate your help!

1

There are 1 answers

0
Micha Be On

I found it: Apparently I did create my own problem a few years ago when trying to use a windows keyboard on my mac to type into a VirtualMachine. Shame on me.

Here is the solution. In my home directory is the file ~/Library/KeyBindings/DefaultKeyBinding.dict

With entries like this:

{
"\UF729"  = "moveToBeginningOfLine:"; /* pos1 */
"^\UF729" = "moveToBeginningOfDocument:"; /* crtl + pos1 */
"$\UF729" = "moveToBeginningOfLineAndModifySelection:";
"\UF72b"  = "moveToEndOfLine:"; /* end */
"^\UF72B" = "moveToEndOfDocument:"; /* ctrl + end */
"$\UF72B" = "moveToEndOfLineAndModifySelection:";
"\UF72C"  = "pageUp:";
"\UF72D"  = "pageDown:";
"^~7" = ("insertText:", "|"); /* orig alt 7 */
"^~8" = ("insertText:", "{"); /* orig alt 8 */
"^~9" = ("insertText:", "}"); /* orig alt 9 */
"^\U00DF" = ("insertText:", "\U00BF");
"^+" = ("insertText:", "\U00B1");
"~<" = ("insertText:", "|");
"~7" = ("insertText:", "{");
"~0" = ("insertText:", "}");
"~8" = ("insertText:", "[");
"~9" = ("insertText:", "]");
"~+" = ("insertText:", "~");
"~\U00DF" = ("insertText:", "\U005C");
"~q" = ("insertText:", "@");
"^x" = "cut:";
"^c" = "copy:";
"^v" = "paste:";
}