8

Windows keyboards map pretty intuitively to OS X, leaving only the "context menu" button a little purposeless. I would like the menu key to behave as another Command key.

How does one define what the "context menu" key on Windows keyboards does in OS X?

enter image description here

On this keyboard, the "context menu" key is directly under the "." (period/greater than) key; on the bottom row between "alt" and "ctrl" on the right side, two keys to the left of the "left arrow" key. What does it do in OS X, and what is it called?

  • 1
    It has neither purpose nor name in OS X. My Win keyboard actually has a second Windows key there, with that one next to it to the right. Maybe Karabiner could do it, if you can figure out what key code it sends - try Key Codes to see if it generates anything usable – Tetsujin Feb 21 '15 at 15:57
  • 1
    We have a special word for information like this here at SE, sir, and that word, sir, is answer! Should you be so kind as to supply this information using the answer box, I shall certainly accept it as such! – ProductionValues Feb 23 '15 at 1:12
  • Glad it helped - one rather crisp & dry answer provided, below :) – Tetsujin Feb 23 '15 at 6:39
8

It has neither purpose nor name in OS X.

Maybe Karabiner could do it, if you can figure out what key code it sends - try Key Codes to see if it generates anything usable.

  • 1
    Key Codes reports code 110 for the "context menu" button, and in deed Karabiner traps and repurposes it like I wanted! – ProductionValues Feb 23 '15 at 6:41
  • Karabiner has EventViewer integrated and offers to copy its findings to clipboard. I found KeyCodes a little confusing as it displays much more than needed by Karabiner. (See my "own" answer below.) – clemsam lang Aug 21 '17 at 16:27
  • With Karabiner's EventViewer I found that the context menu key on my Microsoft keyboard registers as "application". In Karabiner I was then able to map "application" to "right_gui" and it behaves like a Command key. – Jason Heiss Apr 20 '18 at 12:34
6

To expand on @Tetsujin's answer: you can indeed achieve this with Karabiner. Here are some detailed instructions.

In short: go to the Misc & Unistall tab, open private xml, change it to:

<?xml version="1.0"?>
<root>
  <item>
    <name>Menu key to option right</name>
    <identifier>private.menu_key_to_OPTION_R</identifier>
    <autogen>__KeyToKey__ KeyCode::PC_APPLICATION, KeyCode::OPTION_R</autogen>
  </item>
</root>

Go back to the Change Key tab, click Reload XML, and tick the new mapping you just made at the top of the list.

Karabiner has its own keyboard EventViewer in the Misc tab, so you don't need KeyCode.

  • Karabiner no longer has a EventViewer or private.xml link in the misc tab. Won't seem to remap the menu key either. It does trigger as 110 in KeyCodes though – phazei Nov 20 '17 at 3:59
  • EventViewer was moved to the menu item. Also, the key registers as "application" in the EventViewer, so mapping that key did it. Still didn't see any xml option – phazei Nov 20 '17 at 4:05
  • As of Karabiner version 11.5.0, you can use the Simple Modifications tab to add another command key on the right hand side of the keyboard. The keyboard to Karabiner key name translation is: windows key => left command & menu key => application (at least on my keyboard, ymmv). – maogenc Jan 31 '18 at 17:58
2

I found that Seil works to change the "context menu" key to the 'Option' function (I presume it would work to change to 'Command' as well, although I have not tried it) in El Capitan.

In 'System Preferences... | Keyboard' I changed the 'Option' to 'Command' and 'Command' to 'Option', so that the keys are in the same order as on my MacBook Pro, to facilitate "muscle memory".

Then in 'Seil Preferences | Setting | Keys on non-Apple keyboard' I checked 'Enable Application Key (Menu Key)' and set the keycode to '54' (according to 'Seil' this is 'Right Command', but probably because of the switch in 'Keyboard' it functions as 'Option'.

So that gives me this:

Keyboard

0

Karabiner doesn't seem to support OS Sierra yet but Karabiner Elements does. Installing it takes a bit of work but once you've done that you can map "application" to e.g. "right_command" to make it work like you described.

0

I use MacOSX 10.11.6 El Capitan (from a broken Mac mini) on an hp-2570p EliteBook, so the Windows menu-key isn't recognized as "PC_APPLICATION" but simply as "FN" = function key.
Unfortunately this key blocks secondary keys so I had to do some more elaborate twitching to get where I wanted:

Using Karabiner (with integrated EventViewer for information on keys/names/windownames) I reused the key to:
– mimic æ-i in Finder (repeat for closing)
– mimix æ-i in VLC ( – " – )
– do history-back in Safari
Further I made other non-menu-key changes:
redefined some keys that aren't labeled correctly on my German keyboard
– made access to pageUp/Down "one-handed" on my keyboard (not shown)

I'll probably find some more simplifications in other applications over time ...
I used this "individual" code in "private.xml" (details: see post by antoine):

<!-- 1st item redefines <,>,^,° for my keyboard (effective for further items !!!)
<item>  
    <name>Switch_specialKeys_^_°</name>
    <identifier>private.Switch_specialKeys_^_°</identifier>
        <autogen>__KeyToKey__ KeyCode::BACKQUOTE, ModifierFlag::SHIFT_L, KeyCode::GERMAN_U_UMLAUT, ModifierFlag::SHIFT_L | ModifierFlag::OPTION_L</autogen>
        <autogen>__KeyToKey__ KeyCode::BACKQUOTE, KeyCode::6, ModifierFlag::SHIFT_L | ModifierFlag::OPTION_L</autogen>
        <autogen>__KeyToKey__ KeyCode::DANISH_DOLLAR, KeyCode::BACKQUOTE</autogen>
        <autogen>__KeyToKey__ KeyCode::BACKQUOTE, KeyCode::DANISH_DOLLAR, ModifierFlag::SHIFT_L</autogen>
</item>

<!-- Next 2 items differentiate "Cmd-i/-w" via (not-)AXWindow for dual use -->
<item>
    <name>WinR-FNDR æ-I</name>
    <identifier>private.WinMenu_to_Cmd-I</identifier>
    <uielementrole_not>AXWindow</uielementrole_not>
    <only>FINDER</only>
        <autogen>
          __KeyToKey__ KeyCode::FN, KeyCode::I, ModifierFlag::COMMAND_L
        </autogen>
</item>
<item>
    <name>WinR-FNDR æ-W</name>
    <identifier>private.WinMenu_to_Cmd-W</identifier>
    <only>FINDER</only>
    <uielementrole_only>AXWindow</uielementrole_only>
        <autogen>
          __KeyToKey__ KeyCode::FN, KeyCode::W, ModifierFlag::COMMAND_L
        </autogen>
</item>

<!-- For VLC the <uielementrole_only> elements are "AXWindow" for the main
     window and "AXRadioButton" for its information window. -->

<!-- My shortcut for Safari's "history-back" consists of this definition:
     <autogen>
        __KeyToKey__ KeyCode::FN, KeyCode::CURSOR_LEFT, ModifierFlag::COMMAND_L
    </autogen>      -->

For PC applications running under CrossOver the application names aren't recognized by Karabiner, so I used <appdef> to (re)define their names and <windownamedef> to address a particular window; these definitions were then available in <only> and <windowname_only> tags.

0

Repurposing "menu" button on a notebook's Windows keyboard in MacOS 10.12+

There is a new version of Karabiner ("Karabiner Elements 12.1" to be used with MacOS 10.12+) that imho justifies adding a separate answer to this topic, though I posted s.th. similar here before.
[ As I did upgrade to MacOS 10.13 (High Sierra) I had to use ApplePS2SmartTouchPad.kext to be able to re-map the "menu" button, which is now seen as scan_previous_track. ]

With Karabiner Elements you have to edit its ~/.config/karabiner/karabiner.json file, somewhat differently** to the above code …

First find out "menu" button's name on your keyboard via Karabiner EventViewer:
just press it once. [Mine is: scan_previous_track, yours' probably different … ]

Here is some code analogue to parts of what I posted above, opening & closing "Information":

{"description": "Finder: 'menu' key to æ-I / æ-W by pressing or holding",
    "manipulators": [
        { "conditions": [{ "bundle_identifiers": ["^com.apple.finder"],
                                         "type": "frontmost_application_if" }
                        ],
                "from": { "consumer_key_code": "scan_previous_track" },
          "parameters": { "basic.to_if_alone_timeout_milliseconds": 200,
                          "basic.to_if_held_down_threshold_milliseconds": 500
                        },
         "to_if_alone": [{ "key_code": "i",
                           "modifiers": ["right_command"]
                        }],
     "to_if_held_down": [{ "key_code": "w",
                           "modifiers": ["right_command"],
                           "repeat": false
                        }],
        "type": "basic"
        }
                    ]
}

  (If pressed briefly Cmd-I is triggered, after holding the button for half a second: Cmd-W)

from, to… and type are mandatory expressions for re-mapping
conditions, parameters define exclusively affected app(s) and time thresholds for events**
"repeat": false keeps this code from unintentionally closing more than one window
– This code would be inserted between "rules": [ ]'s brackets (possibly with "," added)
    (I made shortcuts for my browser's history-back and -forward function with press & hold, too)
– Have a look into Karabiner Elements json Reference Manual

(** KE no longer supports conditional selection by uielementrole, but a few other conditions.)

You must log in to answer this question.

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