3

I'm using a Cherry G80 (excellent 'clicky' keyboard btw.) on my Macbook Air. Everything works fine, I can use and remap all keys using Ukelele1 or directly in Emacs.

The only key behaving strange is the Context Menu2 Key.

It returns the same Unicode sequence as Control-P.

This is the output of Key Codes3 when pressing the Context Menu key:

Key Down
Characters: 
Unicode:        16 / 0x10
Keys:       
Key Code:   110 / 0x6e
Modifiers:  256 / 0x100

This is the output for Control-P:

Key Down
Characters: 
Unicode:        16 / 0x10
Keys:       ⌃P
Key Code:   35 / 0x23
Modifiers:  262401 / 0x40101

(Notice the difference in 'Keys')

My goal is to use it directly in Emacs or be able to swap it to some other (modifier) key. Is there any way to do this? I can't find a way to bring Ukelele to do that.

  • 1
    You could probably use KeyRemap4MacBook to map it to another key. None of the questions here (1 2 3 4) mention any way to get an actual context menu key on OS X though. – Lri Jul 10 '12 at 17:48
5
+50

Bad news. Apple's XML DTD format that Ukelele targets does not support modifiers outside of shift keys, option keys, control keys, and command keys.

As @Lri suggested KeyRemap4MacBook supports mapping the Context Menu Key, which it calls the Application Key. In KeyRemap4MacBook's preferences go to For PC Users -> Change PC Application Key to see all the supported options. Mappings that may be of use for Emacs: Fn Key; Shift_L Key; Option_L Key; Control_L Key; and, Command_L Key.

| improve this answer | |
  • Thanks for this explanation. KeyRemap4Macbook seems to be working. While I don't really like some application messing with my input, this is an acceptable solution! – jsadfeew Jul 16 '12 at 17:50
1

This is what I've done to map the menu button on my keyboard to the option modifier:

hidutil property --set '{"UserKeyMapping":[{"HIDKeyboardModifierMappingSrc":0x700000065,"HIDKeyboardModifierMappingDst":0x7000000e6}]}'

The approach I used for to first find the key code for the keyboard button. Use https://developer.apple.com/library/archive/technotes/tn2450/_index.html for the list of key codes. To find the key code for button I wanted to change I used

hidutil property --set '{"UserKeyMapping":[{"HIDKeyboardModifierMappingSrc":0x700000065,"HIDKeyboardModifierMappingDst":0x700000004}]}'

which converts the button to the letter 'a.' That way, when I pressed the key on the keyboard, the letter 'a' should appear in the terminal. I kept changing HIDKeyboardModifierMappingDst until I found the key code that I was looking for. Once I knew the source code, I used the table in the link above to figure out what to change it to.

| improve this answer | |
-2

The easiest way is to customize the key layout. You can do this by hand but I'd suggest using the utility Ukelele. I haven't used this on Lion so I don't know how well it works. If you want to do it manually (which I've done in the past as well) here's the tech note from Apple on how to do it.

| improve this answer | |
  • 1
    Please read my question carefully. I can't figure out to make Ukelele do what I want. – jsadfeew Jul 6 '12 at 12:14

You must log in to answer this question.

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