17

tl;dr

what does the first parameters value in com.apple.symbolichotkeys:AppleSymbolicHotKeys represent?

details...

the AppleSymbolicHotKeys structure

the OS X symbolic hotkeys plist file at

~/Library/Preferences/com.apple.symbolichotkeys.plist

stores hotkeys in a dict called as 'AppleSymbolicHotKeys' with entries that look like

<action:int> = Dict {
    enabled = <enabled:bool>
    value = Dict {
        type = <type:string>
        parameters = Array {
            <param_1:int>
            <param_2:int>
            <param_3:int>
        }
    }
}

example:

10 = Dict {
    enabled = true
    value = Dict {
        type = standard
        parameters = Array {
            56
            28
            1572864
        }
    }
}

pro tip: you can take a look with

/usr/libexec/PlistBuddy -c "Print :AppleSymbolicHotKeys" ~/Library/Preferences/com.apple.symbolichotkeys.plist

the values

action:int

this is the id of the action the hotkey will take. there are reasonably complete lists around the net, do some googling 'cause i don't have enough points to post links or whatever.

enabled:bool

whether the hotkey is enabled.

type:string

always seems to be 'standard'.

param_1:int

this is the one i can't get. it doesn't seem necessarily connected to params 2 and 3, though it often changes when the other params are changed. for instance...

i can click Restore Defaults in the System Preferences -> Keyboard -> Shortcuts -> Mission Control view, and it will set "Switch to Desktop 1" to "ctrl + 1". reading the value for that action (number 118), i see that param_1 is set to 65535. if i manually set the key combo to "ctrl + 1" in the UI, i get param_1 set to 49. the values of param_2 and param_3 stay the same throughout.

param_2:int

this seems to be key codes from

/System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/HIToolbox.framework/Versions/A/Headers/Events.h

for the non-modifier key to be pressed, except for the value 65535, which is very common in param_1, and shows up in param_2 on my local machine for actions 160, 163 and 175.

param_3:int

seems to indicate the modifier key to be depressed, as according to

MODS = {
  0=>"No modifier",
  131072=>"Shift",
  262144=>"Control",
  524288=>"Option",
  1048576=>"Command",
  393216=>"Shift + Control",
  655360=>"Shift + Option",
  1179648=>"Shift + Command",
  786432=>"Control + Option",
  1310720=>"Control + Command",
  1572864=>"Option + Command",
  917504=>"Shift + Control + Option",
  1441792=>"Shift + Control + Command",
  1703936=>"Shift + Option + Command",
  1835008=>"Control + Option + Command",
  1966080=>"Shift + Control + Option + Command",
}

where you will notice the numbers representing multiple modifiers are the sum of the modifiers they represent, e.g.

"Shift + Control" = 393216 = 131072 + 262144 = "Shift" + "Control"

so...

any insight would be greatly appreciated, and hope this can serve as a reference for the info i dug up to anyone else approaching the subject.

3
  • 2
    Could you provide link to the list of this actions. I cannot resolve which action id is for which action in Keyboard Shortcuts preferences pane :( Aug 28, 2016 at 8:29
  • how it is connected to function CopySymbolicHotKeys() ? Aug 28, 2016 at 8:32
  • For the modifiers, search on NX_SHIFTMASK in IOLLEvent.h. For the actions ("param_2"), I think a reverse engineered CGSHotKeys.h may help. Key codes seem to come from HIToolbox's Events.h.
    – Dale
    Jun 30, 2019 at 7:47

3 Answers 3

7

It is the ascii code of the letter on the key, or -1 (65535) if there is no ascii code. Note that letters are lowercase, so D is 100 (lowercase d).

Sometimes a key that would normally have an ascii code uses 65535 instead. This appears to happen when the control key modifier is used, for example with hot keys for specific spaces.

There is a nice list of keys and values from 2011 here, along with some other good details:

http://hintsforums.macworld.com/showthread.php?t=114785

1
6

The numerical values in nrser's answer make more sense when viewed in hexadecimal form:

0x000000 => "No modifier",
0x020000 => "Shift",
0x040000 => "Control",
0x080000 => "Option",
0x100000 => "Command",

The others are simply bit-wise-ORs of the above values, for example:

0x060000 => "Shift + Control",
0x180000 => "Command + Option",
0

In addition to what's already been said, I've compiled a JSON manifest of all 256 possible modifier bitwise-operated results — including the function keys:

https://gist.github.com/stephancasas/74c4621e2492fb875f0f42778d432973

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.