In a ".keylayout" file there is <layout> element where you can specify a "mapSet" and "modifierMap" for a range of keyboard types. Apples Technical Note TN2056 describes the XML file structure, but not what a "keyboard type hardware ID" actually is. They say:

Apple will map new keyboard hardware IDs to one of the existing ones, so it is usually sufficient to copy and paste the entire element from an existing keyboard layout.

Great, but I really would like to understand what this ID is.

At first look it seems like ID 0 through 17 are ANSI keyboards, but when I look at the key layout for European layouts (which are usually ISO keyboards) I find ID 0 and 1, so I guess the IDs are not related to ANSI/ISO/JIS.

1 Answer 1


I got an excellent answer in the Google Group "Ukelele Users" (link directly to the answer) from John Brownie. The hardware ID is what is returned by CGEventSourceGetKeyboardType. Mr Brownie writes:

The keyboard ID is what is reported back to the system when certain system calls are made. Historically, these were 'gestalt' calls, but currently it uses Quartz Events, calling CGEventSourceGetKeyboardType.

For a list of IDs, see the answer in the group.

This site is temporarily in read-only mode and not accepting new answers.

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