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
.)