3

I would like to remap my Left Control to Fn key using hidutil. This is the command I've been trying to use:

hidutil property --set '{"UserKeyMapping":[{"HIDKeyboardModifierMappingSrc":0x7000000E0,"HIDKeyboardModifierMappingDst":0x7000000??}]}'

There is a list of hex IDs on this page: https://developer.apple.com/library/archive/technotes/tn2450/_index.html but Fn key is not there.

I couldn't find it in a USB specification either: https://www.usb.org/sites/default/files/documents/hut1_12v2.pdf.

The ID (0x3F) found in this document: https://github.com/tekezo/Karabiner/blob/master/src/bridge/generator/keycode/data/KeyCode.data is wrong.

What is the hex code for Fn key that I can use with hidutil? Or is it not possible what I've been trying to do?

(I would have remapped the keyboard using Karabiner-Elements if it wasn't buggy on my computer.)

3 Answers 3

3

Apparently the keycodes are:

left-fn:  1095216660483
right-fn: 280379760050179

Got it from another Ask Different thread.

I used that to remap right-option to fn via the terminal:

hidutil property --set '{"UserKeyMapping":[{"HIDKeyboardModifierMappingSrc":0x7000000E6,"HIDKeyboardModifierMappingDst":1095216660483}]}'
2

I got this from Key Codes (freeware)

Fn key down

Modifier Change
    Keys:       
    Key Code:   65535 / 0xffff
    Modifiers:  8388864 / 0x800100 ⓘ

NX_SECONDARYFNMASK / kCGEventFlagMaskSecondaryFn / NSFunctionKeyMask = 8388608 / 0x800000

NX_NONCOALSESCEDMASK / kCGEventFlagMaskNonCoalesced = 256 / 0x100

Fn key up

Modifier Change
    Keys:       
    Key Code:   65535 / 0xffff
    Modifiers:  256 / 0x100 ⓘ

NX_NONCOALSESCEDMASK / kCGEventFlagMaskNonCoalesced = 256 / 0x100

tbh, it doesn't really mean a great deal to me, I'm no coder... ;)

1
  • I tried those codes but they don't work, or at least not with hidutil. Thanks though.
    – Mateusz
    Oct 25, 2018 at 12:37
0

Found this awesome app someone made which will generate the mapping command for you if you select the source and destinations keys from a dropdown: https://hidutil-generator.netlify.app/

I was able to remap the fn key using the value 0xFF00000003.

You must log in to answer this question.

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