MacOS X(10.2, 10.3)でキーボード配列を変更する方法
To modify keymaps in MacOS X(10.2, 10.3 ; I don't know of 10.4)
There is no warranty for this content.
Reference
Apple Developer Connection, Document no. tn2056.
http://developer.apple.com/technotes/tn2002/tn2056.html
In Japanese
http://developer.apple.com/ja/technotes/tn2056.html
Introduction
We occasionally face the problem of unfavourite keylayout that cannot be
changed to favourite keylayout.
For instance, Old Mac fans, who have use the Mac until white Macintosh,
habituate ASCII keylayout, because old Macintosh often has ASCII
keyboard. Nowadays, however, new macintosh for Japanese has JIS
keyboard. Old Mac fans may intend to use ASCII keyboard.
In other case, someone want to use US(ASCII) keyboard as JIS keylayout.
Third-party of Mac keyboards provide only ASCII keyboard. New Macintosh
users may intend to use JIS keyboard, because default new Macintosh
keyboard is JIS.
Solution
In Mac OS X(>=10.2), Apple provides modifying keylayout methods(See
reference). Who want to modify keylayout would get his keylayout, if he
edits configuration file for keylayout and copies that file to
~/Library/Keyboard\ Layouts/ and logout. This configuration file is
made in XML. Therefore, it is easy to edit with XML editors or Text
editors. The most of difficulty is to search key code each by each, or
bother to type it
Most of cases in Japanese could belong to JIS=>ASCII or ASCII=>JIS.
Now, I set here two keylayout configuration files; One offers to set
ASCII keylayout, even if JIS keyboard are inserted; Second file offers
to set JIS keylayout, even if ASCII keyboard are inserted.
US(ASCII) keyboard to JIS keylayout
US2JIS.keylayout
JIS keyboard to US(ASCII) keylayout
alwaysus.keylayout
Extra: Apple/GS Keyboard (ADB) to JIS keylayout by using the device
convert ADB to USB (e.g. iMate)
AppleKB2JIS.keylayout
My favourite layout
logical.keylayout
logical.icns (icon file)
it permits "SHIFT+0" as "/underscore/".
HHK ascii layout (by Wada Eiiti) for logical layout (Bs at right top)
logical4sun3.keylayout
logical4sun3.icns (icon file)
it permits "SHIFT+0" as "/underscore/".
Usage
Choose which you want and download. Move this file you chosen to
your home directory's Library folders Keyboard Layouts folder.
You can consult this figure.
If you use "Terminal", that is simple.
If you type,
cp "chosen file" ~/Library/Keyboard\
Layouts/
file translation will be completed.
Note that "chosen file" is xxx.keylayout
and xxx.icns
(if exists).
If you are an administrator to want that all accounts can use this.
Type,
sudo cp "chosen file" /Library/Keyboard\
Layouts/
Now, configuration is going to finish.
To reflect your change, "Logout" and "Login".
If you see like this figure, you already have succeeded.
Remarks
Exactly, the term "ASCII keyboard layout" is incorrect, while many
people misuse this term. Practically, this layout can be called US
layout. Literally, this layout is seemed to be ANSI X3.154-1988 (not
certain).
JIS layout is derived from JIS C 6233, which is based on ISO 2530-1975.
Hacks
The files difining keyboard layout are written in XML.
They are in quite simple strucures, simple table;
variable=value
<key code="19" output="2" />
It means key code 19 outputs "2." Therefore, if you want
shift+2 should outout @
, go <keyMap index="1">
section (shift+key definition part), and edit
the line key code 19, like <key code="19" output="@" />
.
For example, "&#xD"
means hexadecimal D (decimal 13;
return in ASCII). Like above, x1B is escape, 9 is horisontal tab, and
other hexadecimal values have meaning in ASCII.
Over xFF, you may consult UTF-8 sheet (Unicode).
You can modify the values of keymap's output you want.
If you read the source, you can see what it works and how you can realise.
Copyright (C) 2001-2004 TuZINO Taqumi. All rights reserved.