Sunday, December 22, 2024

keyboard – The best way to disable particular hotkey in Sonoma?

Step one in disabling a system hotkey that is not listed in Keyboard Shortcuts System Settings is to run defaults learn com.apple.symbolichotkeys.plist | much less and discover the related one.

Some filtering standards that can be utilized are:

  1. The third parameters worth are modifiers (eg ⌥, Fn, and many others). Modifier values might be present in https://gist.github.com/stephancasas/74c4621e2492fb875f0f42778d432973 and https://github.com/phracker/MacOSX-SDKs/blob/grasp/MacOSX10.6.sdk/System/Library/Frameworks/Carbon.framework/Variations/A/Frameworks/HIToolbox.framework/Variations/A/Headers/Occasions.h
  2. The second parameters worth are key codes. Key codes might be present in https://eastmanreference.com/complete-list-of-applescript-key-codes
  3. The primary parameters worth are ASCII codes for the important thing. Because you’re coping with perform keys, that worth will probably be 65535
  4. If you happen to’re making an attempt to disable a hotkey, it is protected to imagine that enabled = 1

What does every half in com.apple.symbolichotkeys.plist imply? has extra data on the way to decode com.apple.symbolichotkeys.plist

Placing all these collectively:

  1. Because you’re coping with ⌥ and Fn, the third parameters worth ought to be 524288 + 8388608 which is the same as 8912896
  2. The second parameters worth ought to be 107 for F14 and 113 for F15
        55 =         {
            enabled = 1;
            worth =             {
                parameters =                 (
                    65535,
                    107,
                    8912896
                );
                sort = customary;
            };
        };
        56 =         {
            enabled = 1;
            worth =             {
                parameters =                 (
                    65535,
                    113,
                    8912896
                );
                sort = customary;
            };
        };

To disable these, execute:

defaults write com.apple.symbolichotkeys.plist AppleSymbolicHotKeys -dict-add 55 "
  <dict>
    <key>enabled</key><false/>
    <key>worth</key><dict>
      <key>sort</key><string>customary</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>worth</key><dict>
      <key>sort</key><string>customary</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/Assets/activateSettings -u

Related Articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest Articles