Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

memphismac

macrumors member
Original poster
Oct 22, 2003
88
3
I just bought a new iMac (first in six years) with the larger keyboard. This keyboard includes F13-F19 keys that don't seem to have much purpose.

Since I'm used to the smaller keyboard and having the back/play/forward and volume controls in the top right of the keyboard, I was hoping to assign those functions to those keys in the top right of this keyboard.

In short, I'd just like F13-15 and F17-19 to function exactly as F7-F12 do.

Any suggestions?

Thanks,
Brian
 
This script which calls the built-in "hidutil" command should do exactly that (1:1 low-level key remapping).

Code:
#!/usr/bin/env bash

# REF: https://developer.apple.com/library/archive/technotes/tn2450/_index.html

hidutil property --set '
{
    "UserKeyMapping": [
        {
            "HIDKeyboardModifierMappingSrc":0x700000068,
            "HIDKeyboardModifierMappingDst":0x700000040
        },
        {
            "HIDKeyboardModifierMappingSrc":0x700000069,
            "HIDKeyboardModifierMappingDst":0x700000041
        },
        {
            "HIDKeyboardModifierMappingSrc":0x70000006a,
            "HIDKeyboardModifierMappingDst":0x700000042
        },
        {
            "HIDKeyboardModifierMappingSrc":0x70000006c,
            "HIDKeyboardModifierMappingDst":0x700000043
        },
        {
            "HIDKeyboardModifierMappingSrc":0x70000006d,
            "HIDKeyboardModifierMappingDst":0x700000044
        },
        {
            "HIDKeyboardModifierMappingSrc":0x70000006e,
            "HIDKeyboardModifierMappingDst":0x700000045
        },
    ]
}' >/dev/null

To have it keep taking effect every time you reboot/login, it will need to be run from a launchd "LaunchAgent".
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.