What is the hex ID for Fn key

Solution 1:

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

Solution 2:

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}]}'