Format of AppleKeyboardLayouts-L.dat

71 views
Skip to first unread message

John

unread,
Apr 4, 2024, 12:23:35 PMApr 4
to Ukelele Users
Hi,

I am curious if there is any information about the AppleKeyboardLayouts-L.dat file, and how system keyboard layouts are stored. I came across this Gist which describes part of the structure https://gist.github.com/frkd-dev/bc2b0a129c6cba20d98afca7ce32dcd7.  I have modified it a bit to match correctly (as far as I know).  Looking at the data for the layout I don't know what format it is in.  Each item seems to start with 0x02 0x10 0x00 0x01, and running the file command returns "data".

There is not much online about this file format, and i figured this group would be the best place to ask.


Thanks

John Brownie

unread,
Apr 5, 2024, 10:20:49 AMApr 5
to ukelel...@googlegroups.com
Nothing is documented by Apple, and I haven’t tried to reverse engineer the data. I suspect that the ‘uchr’ resource is the basis of the data format, but I haven’t looked to see if that is the case. The specification for ‘uchr’ should be fairly easily found on the internet.

John

John

unread,
Apr 5, 2024, 9:54:23 PMApr 5
to Ukelele Users
Thank you. After some inspection, this seems to be the case.

Oleksandr

unread,
Apr 6, 2024, 3:40:48 AMApr 6
to Ukelele Users
Hi,

You, by the way, found my gist. :) I also have some unpublished improvements for the script but they are minor though. My main point of interest is to get a layout that supports a new TISIconLabels property-based approach to display textual language codes instead of icons as they are not displayed in certain situations. Layout bundles do not support this new property as per my findings but the .dat file contains embedded binary plists that provide such support.

As per my findings, layouts in the .dat are quite similar to old .rsrc layouts used in macOS earlier. There is even a website [1] that can create .rsrc layouts. Further googling brought me to the info that .rsrc files are "resource forks" [2] but after downloading and reading specifications about resource forks I still cannot understand .rsrc format. I sent an email to the webpage's author asking for help to understand it but didn't get a reply.

Now I'm thinking that layouts in the .dat file are indeed in the uchr format, not resource forks, but I still cannot find uchr format specification despite it being mentioned in macos code headers [3] and the official documentation [4].


Oleksandr

John Brownie

unread,
Apr 6, 2024, 5:00:43 AMApr 6
to ukelel...@googlegroups.com
The uchr specification is in a document from 2003 entitled Unicode Utilities Reference, Appendix A. I’ve attached a copy of the PDF. Not of interest to many, but there seem to be a few on this list!

John

--
You received this message because you are subscribed to the Google Groups "Ukelele Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ukelele-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ukelele-users/ca25397e-f6f8-4371-a584-fe57007ba995n%40googlegroups.com.
UnicodeUtilitiesReference.pdf

Gé van Gasteren

unread,
Apr 6, 2024, 5:25:29 AMApr 6
to ukelel...@googlegroups.com
On Sat, Apr 6, 2024 at 9:40 AM Oleksandr <stu...@gmail.com> wrote:
after downloading and reading specifications about resource forks I still cannot understand .rsrc format.Hi,

Hi Oleksandr,

Maybe this can clear up the situation:
In the distant past, Mac software (OS and applications) was structured like a bag with lots of smaller objects inside, divided in two "forks": the data fork (containing objects with interface texts and other strings, error messages, etc.) and the resource fork (containing binary stuff and code).

The uchr object was in the resource fork.

In those days, every OS version had only one uchr object, if I remember correctly, so if you wanted to change the keyboard layout, you would have to go into it with a utility like ResEdit and change the hex code.

Oleksandr Shashkevych

unread,
Apr 6, 2024, 6:18:07 AMApr 6
to ukelel...@googlegroups.com
What a valuable piece of information! Now I’m equipped to move further in parsing the .dat file.

Thank you John!

Best regards,
Oleksandr 

On 6. Apr 2024, at 11:00, John Brownie <john_b...@sil.org> wrote:


You received this message because you are subscribed to a topic in the Google Groups "Ukelele Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/ukelele-users/xRo9BwPeFpg/unsubscribe.
To unsubscribe from this group and all its topics, send an email to ukelele-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ukelele-users/CAC13VMw%3D1aHmdtQXMp7h%3DTiGQVfLBURkykefftpO_giF%3Dra9gg%40mail.gmail.com.
<UnicodeUtilitiesReference.pdf>

Oleksandr Shashkevych

unread,
Apr 6, 2024, 6:24:24 AMApr 6
to ukelel...@googlegroups.com
That’s definitely good to know how uchr relates to resource forks! At least now I know I shouldn’t move in the direction of digging fork’s format.

Thank you!

Oleksandr 

On 6. Apr 2024, at 11:25, Gé van Gasteren <gevang...@gmail.com> wrote:


--
You received this message because you are subscribed to a topic in the Google Groups "Ukelele Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/ukelele-users/xRo9BwPeFpg/unsubscribe.
To unsubscribe from this group and all its topics, send an email to ukelele-user...@googlegroups.com.

John

unread,
Apr 8, 2024, 12:58:44 PMApr 8
to Ukelele Users
That PDF is a great resource. I also found this repository which was helpful https://github.com/stefslon/iOSKeyboardEditor. I'll eventually release the ImHex pattern for this file.
Reply all
Reply to author
Forward
0 new messages