1

I have minor dexterity problems and I keep hitting F12 when I want delete (usually I get both as the top of my finger brushes F12). I use the delete key a lot!

Is there a way to disable a function key?

I know how to remap the key to a menu entry so a no-op menu entry would do as well.

2
  • 1
    Just a thought, you could remap it to delete as well... Commented Feb 28 at 22:05
  • @SteveChambers What menu item would you map it to? There's no menu entry for Backspace.
    – Barmar
    Commented Feb 28 at 22:06

1 Answer 1

3

You don’t need to remap a key to menu item specifically; remap it to a null value or another key. To do this, use the hidutil command to remap F9 to a null value, backspace, or something else.

hidutil property --set '{"UserKeyMapping":\
[{"HIDKeyboardModifierMappingSrc":0x700000045,\
"HIDKeyboardModifierMappingDst":0x700000000}]}'

Please note: the backslashes at the end of the lines allow this command to span multiple lines for readability. You can copy/paste this command as is or remove the backslashes for a true one liner

Now, the source (hex) value of F12 is 0x700000067 and the destination value is 0x700000000. I haven't tested this particular value but, should it not work, you can use 0x70000002A or 0x7000000E6 for a second backspace (it’s the key you intended to hit anyway), or something like right ⌥ Option respectively.

This solution is based on this answer which I previously wrote for a similar question; there are several codes for function keys listed there. If you need a list of hex codes for additional keys, Apple provides a Technical Note on hidutil for your reference.

2
  • Was it the backslashes? Let me know what the typos were and I’ll be happy to fix.
    – Allan
    Commented Mar 1 at 20:01
  • Thanks for the catch @RussellFulton, I fixed per your recommendation.
    – Allan
    Commented Mar 3 at 0:29

You must log in to answer this question.

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