Create your own custom Unicode keyboard for Mac OS 9 or X!
Enter your layout specification in the box below, choose a Layout Name and Script / Resource ID (see notes on choosing scripts), and submit to get a keyboard layout resource file, and install by following the installation instructions.
Depending on its Resource ID, every keyboard layout is associated with a script. The script determines how to translate the layout's two-byte (0-65535) Unicode character values to one-byte (0-255) character values. These one-byte values are used by non-Unicode-supporting applications (chiefly older "Carbonized" applications such as AppleWorks 6, Microsoft Word X, and just about any "Classic" Mac OS application). These applications use the Script Manager to coordinate the script, character value, and font, as the same character value may represent different letters in different script-specific fonts. Script is ignored by Unicode-supporting applications (all Cocoa applications and most new Carbon applications written for Mac OS X). These applications work with the characters directly as Unicode characters, and font switching is done on a character-by-character basis.
Also, in older versions of Mac OS, the layouts in the keyboard menu would be grouped by script. The keyboard shortcut of command-space would switch to the last selected layout of the next group, while command-option-space would switch to the next layout in the current group. In OS X v10.5 "Leopard" and later, there are no groups. The command-space keyboard shortcut (if activated) simply switches to the previous layout, and command-option-space switches to the next layout in the menu, both regardless of script.
In Mac OS X, installable keyboard layouts may be of one of four scripts: Roman, Cyrillic, Central European, or Unicode. The "Unicode" script essentially means "not for use with Script Manager-based applications".
An input is defined as an optional modifier code followed by
a key code.
Valid key codes are (lowercase) letters of the alphabet,
numbers, and the fourteen symbols
-- optionally preceded by a number sign (#
).
A key code beginning with number sign indicates a key on the numeric keypad.
Each key code corresponds to the key on the standard keyboard that you must press to get that
symbol, except for the underscore (_
),
which stands for the space bar.
Note that the section sign (§
) corresponds to the key above tab on the
ISO Extended (physical) Keyboard; it does not correspond to any key on
U.S. standard physical keyboards. Likewise, the Japanese (JIS) keyboard has
two unique keys: the Yen key (¥
) just left of the delete key,
and a key for underscore just left of the right shift key,
represented by a number sign-preifxed underscore (#_
).
Valid modifier codes are P (plain), S (shift and shift-caps), C (caps),
O (option), OS (option-shift and option-shift-caps), OC (option-caps),
M (command), and T (control).
"P" means you don't press any modifier keys. If the modifier code is omitted,
"P" is assumed.
An output is defined as a string of characters, where each character stands for itself, except that spaces (including tabs) and colons (:) are not permitted. A dollar-sign ($) followed by up to six hexadecimal digits (0-9,a-f) and, optionally, terminating dot (".") represents the corresponding Unicode character. Leading zeroes are optional. Spaces are represented as "$20", dollar signs as "$24", and colons as "$3A".
A submapping is a space-delimited series with elements of the form: original output, colon(:), new output. Note that it is not key codes that are mapped to new outputs, but outputs that are mapped to other outputs.
Note also that if, for a given key code, there is an output for C or OC, that output is automatically assigned to S or OS, respectively. In other words, outputs defined as "capital" letters are accessible through both caps and shift. However, it is possible to define outputs for both (O)C and (O)S, in which case, the results for caps and shift will be different. In all cases, pressing caps and shift together is the same as just pressing shift.
:: Some Simple Rules Sa abc ::Shift-A key generates the sequence "abc" Oa $0447 ::Option-A generates Cyrillic Letter Che. S4 $0024 ::Shift-"4" is the dollar sign (but not Caps-"4"). S; colon ::Shift-semicolon (ordinarily ":") now spells out "colon" #1 one ::"1" on the numeric keypad spells out "one" C#1 ONE ::Caps version of the above (accessible through caps or shift) :: Three rules that give three levels of capitalization. Os sh ::Option-S generates the sequence "sh". OCs SH ::All caps OSs Sh ::Just shift (init caps). :: The following examples illustrate the function of "." e $10429 ::The "e" key generates Deseret small long e. Se $104.29 :: Shift-"e" generates captal A with hook below, followed by "29". :: option-minus will give you a macron (U+00AF), UNLESS it is :: followed by an a, in which case you will get a+macron, same for e, etc. O- $AF a:$101 e:$113 i:$12B o:$14D u:$16B :: This does the same thing, except with combining characters ($304 = :: combining macron). With the combining macron, we can also specify :: n-macron and m-macron, which don't have their own single Unicode :: code points. Note that the code for the standalone macron is $AF, :: while the combining version is $304. O- $AF a:a$304 e:e$304 i:i$304 o:o$304 u:u$304 n:n$304 m:m$304
Note: If you are having trouble with the XML layout, You may also try the .rsrc (binary) format. (In the past, layouts with either 1 or 2 submappings did not work in the XML format. This has been corrected as of Nov 20, 2002.) You may rename your generated file (preserving the .rsrc suffix) to distinguish it from other .rsrc files in your Keyboard Layouts folder, but this will not have an effect on the name that shows up in the keyboard menu. Please let me know at if you get differing results for .keylayout and .rsrc keyboard files with the same keyboard definition.
#!/bin/sh suitcase=/System/Library/Frameworks/Carbon.framework/Frameworks/HIToolbox.framework/Resources/HIToolbox.rsrc resource=$1 if test -w $suitcase; then /Developer/Tools/Rez -append -useDF -o $suitcase $resource else echo "You don't have permission to add a resource to $suitcase." >&2 fi
With the web tool, generate a "Mac OS 9 Keyboard File". This will give you a file, "layout.as", which has your layout encoded in the "AppleSingle" transfer encoding. Decode it with your favorite "expander" application if your browser doesn't do it for your automatically. If all goes well, you will end up with a keyboard layout file (the icon will have a picture of a keyboard on it if you are in Mac OS 9) with the name of your layout, in your downloads folder (or on the desktop). The "layout.as" file may be put in the trash. In the extremely unlikely event your system cannot handle AppleSingle, you may try the following instead:
With the web tool, generate a "Raw Hexadecimal" resource. Select all and copy.
Launch ResEdit, and create a new file (From the
"File" menu, select "New"), and give it a name the same as your layout.
Then select "new resource" from the Resource menu (or Command-K) type in
Note: If the resource ID of the layout you created is the same as an
existing keyboard, the new keyboard will replace the old one. You can use
ResEdit to examine the copy of your old System Folder to find the conflicting
'uchr' or 'KCHR' (old-style keyboard) ID.
Now, make a backup copy of the "System" file (inside your System Folder).
Drag the keyboard file you just downloaded (or created)
onto the System file (or you can drag it onto the closed System Folder).
You will probably get some self explanatory dialog boxes before the
Macintosh lets you actually add the resource.
uchr
(note: all lower case!) and click OK. Now paste. Close
the "uchr ID = 128" window, and then select "Get Resource Info" from the
Resource menu. Check "System Heap" and "Purgeable", and replace the number
128 with a negative number between -100 and -32767, and again set the name
to be the same as your layout. Close that window. Select "Get info for
kfil
and the creator to movr
. Then Save and Close from the File
menu.