logoalt Hacker News

tom_today at 3:08 AM1 replyview on HN

My Mac has no keyboard, it's just a metal box that sits on your desk - so an external keyboard is the only option. Nobody told me I had to get any specific type in particular!

It looks like you can still use hidutil to remap some other key. This invocation seems to remap the Application key to the fn key:

    sudo hidutil property --set '{"UserKeyMapping":[{"HIDKeyboardModifierMappingSrc":0x700000065,"HIDKeyboardModifierMappingDst":0xFF00000003}]}'
On my keyboard, metakeywise, I then have 2 x Shift, 2 x Ctrl, 2 x Option (marked Alt), 2 x Command (marked Start), 1 x undetectable-to-macOS (marked Fn), and 1 x Fn (got that little Windows context menu logo on it).

Replies

junk245435254today at 4:38 AM

Yep, this is what I have in my Bash config, for the external Microsoft Natural Keyboard attached to my Mac:

    # note: works for e.g. Fn-F (fullscreen), but not Fn-F{1..12} (brightness etc.)
    alias app2fn+=$'hidutil property --set \'{"UserKeyMapping":[{"HIDKeyboardModifierMappingSrc":0x700000065,"HIDKeyboardModifierMappingDst":0xFF00000003}]}\''
    alias app2fn-=$'hidutil property --set \'{"UserKeyMapping":[]}\''
    alias app2fn?=$'hidutil property --get "UserKeyMapping"'