hidutil-key-remapping-generator
hidutil-key-remapping-generator copied to clipboard
Please add support for special keys.
Please add support for the M1 Macbook Special keys, e.g. Spotlight, Launchpad, Mission Control.
After looking through the sources of some other applications, I managed to find this
namespace apple_vendor_keyboard {
constexpr value_t spotlight(0x0001);
constexpr value_t dashboard(0x0002);
constexpr value_t function(0x0003);
constexpr value_t launchpad(0x0004);
constexpr value_t reserved(0x000a);
constexpr value_t caps_lock_delay_enable(0x000b);
constexpr value_t power_state(0x000c);
constexpr value_t expose_all(0x0010);
constexpr value_t expose_desktop(0x0011);
constexpr value_t brightness_up(0x0020);
constexpr value_t brightness_down(0x0021);
constexpr value_t language(0x0030);
} // namespace apple_vendor_keyboard
I'm not sure if it'll be of use, I found this from https://github.com/pqrs-org/Karabiner-Elements and this https://eastmanreference.com/complete-list-of-applescript-key-codes
Depending on your keyboard (topcase/external/vendor) and macbook model these will vary, adapt based on your needs/hardware. Hope this helps.
Media Control Keys | Hex code |
---|---|
display_brightness_decrement | 0x0C00000070 or 0xFF0100000021 or 0x00FF00000005 |
display_brightness_increment | 0x0C0000006F or 0xFF0100000020 or 0x00FF00000004 |
launchpad | 0x0C000002A2 or 0xFF0100000004 |
mission_control / expose | 0xFF0100000010 |
spotlight | 0x0C00000221 or 0xFF0100000001 |
dictation | 0x0C000000CF |
do_not_disturb | 0x010000009B |
keyboard_brightness_decrement | 0xFF00000009 |
keyboard_brightness_increment | 0xFF00000008 |
rewind | 0x0C000000B4 |
play_or_pause | 0x0C000000CD |
fast_forward | 0x0C000000B3 |
volume_decrement | 0x0C000000EA |
volume_increment | 0x0C000000E9 |
dashboard | 0xFF0100000002 |
Apple HID Usage Tables
- 0xFF01 - kHIDPage_AppleVendor
- 0x00FF - kHIDPage_AppleVendorKeyboard
USB HID Usage Tables
- 0x0C Consumer Page
- 0x07 Keyboard/Keypad Page
Sources:
- https://github.com/kevingessner/FunctionFlip/blob/master/FFDefs.h
- https://opensource.apple.com/source/IOHIDFamily/IOHIDFamily-1035.70.7/IOHIDFamily/AppleHIDUsageTables.h.auto.html
- https://opensource.apple.com/source/IOHIDFamily/IOHIDFamily-1633.81.2/IOHIDFamily/IOHIDUsageTables.h.auto.html
- https://mybyways.com/blog/script-to-re-map-macbook-pro-function-keys
- https://www.reddit.com/r/MacOS/comments/jy5ry8/m1_macbook_air_keysshortcut_for_keyboard/?utm_source=share&utm_medium=web2x&context=3
- https://developer.apple.com/library/archive/technotes/tn2450/_index.html
- https://usb.org/document-library/hid-usage-tables-14
@gregbook thanks, very useful for me, I have tried long to find a simple way to remap launchpad(fn + F4) to volume up(fn + F12) while keeping f-key as it's own, BetterTouchTool and Karabiner-Elements can make it, but I don't want to install additional software. It wasn't resolved until I saw your reply.
Thanks Again!