Home Apple How to disable specific hotkey in Sonoma not referred to in Keyboard Shortcuts System Settings?

How to disable specific hotkey in Sonoma not referred to in Keyboard Shortcuts System Settings?

0
How to disable specific hotkey in Sonoma not referred to in Keyboard Shortcuts System Settings?

The first step in disabling a system hotkey that’s not listed in Keyboard Shortcuts System Settings is to run defaults read com.apple.symbolichotkeys.plist | less and find the relevant one.

Some filtering criteria that can be used are:

  1. The third parameters value are modifiers (eg , Fn, etc). Modifier values can be found in https://gist.github.com/stephancasas/74c4621e2492fb875f0f42778d432973 and https://github.com/phracker/MacOSX-SDKs/blob/master/MacOSX10.6.sdk/System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/HIToolbox.framework/Versions/A/Headers/Events.h
  2. The second parameters value are key codes. Key codes can be found in https://eastmanreference.com/complete-list-of-applescript-key-codes
  3. The first parameters value are ASCII codes for the key. Since you’re dealing with function keys, that value will be 65535
  4. If you’re trying to disable a hotkey, it’s safe to assume that enabled = 1

What does each part in com.apple.symbolichotkeys.plist mean? has more info on how to decode com.apple.symbolichotkeys.plist

Putting all those together:

  1. Since you’re dealing with and Fn, the third parameters value should be 524288 + 8388608 which is equal to 8912896
  2. The second parameters value should be 107 for F14 and 113 for F15
        55 =         {
            enabled = 1;
            value =             {
                parameters =                 (
                    65535,
                    107,
                    8912896
                );
                type = standard;
            };
        };
        56 =         {
            enabled = 1;
            value =             {
                parameters =                 (
                    65535,
                    113,
                    8912896
                );
                type = standard;
            };
        };

To disable those, execute:

defaults write com.apple.symbolichotkeys.plist AppleSymbolicHotKeys -dict-add 55 "
  <dict>
    <key>enabled</key><false/>
    <key>value</key><dict>
      <key>type</key><string>standard</string>
      <key>parameters</key>
      <array>
        <integer>65535</integer>
        <integer>107</integer>
        <integer>8912896</integer>
      </array>
    </dict>
  </dict>
"
defaults write com.apple.symbolichotkeys.plist AppleSymbolicHotKeys -dict-add 56 "
  <dict>
    <key>enabled</key><false/>
    <key>value</key><dict>
      <key>type</key><string>standard</string>
      <key>parameters</key>
      <array>
        <integer>65535</integer>
        <integer>107</integer>
        <integer>8912896</integer>
      </array>
    </dict>
  </dict>
"

Then to reload the system hotkeys, execute /System/Library/PrivateFrameworks/SystemAdministration.framework/Resources/activateSettings -u

LEAVE A REPLY

Please enter your comment!
Please enter your name here