How to remap ‘Context Menu’ key on external keyboard

keyboardukelele

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.

Best Answer

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.