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.
Best Answer
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:For a list of IDs, see the answer in the group.