This article was written for the stepwise publication. Using non US-kepmappings under Mac OS X DP4With full Unicode support in all layers, a language aware common plug-in and application structure, the rich set of bundled fonts, and the ability to define language preferences on a per user basis, one can say that Mac OS X has internationalization written all over it. The system ships with all supported languages on one CD at the same time. So Japanese or German customers will no longer have to wait a few extra weeks or month before they can use a new release. People with a non-US-keyboard, e.g. a Dvorak layout, tend to find out fairly quickly if a system supports arbitrary keymappings correctly or not ... and Mac OS X DP4 has its problems. It is our policy not to write about prerelease software but since DP4 was released to an international audience and its release notes do not mention the keyboard issue we think that spreading the word about how to work around the currently existing problems is crucial. Without being able to successfully type a character the whole beta test will become a frustrating experience and thereby will cast an unnecessary shadow on a totally amazing operating system.
The problem can be divided up into two areas. First we have the need to define a default keyboard layout, which will remove the need to switch the keyboard after the launch of each and every application. When done for the user "root" this will ensure that the login window will use the right keymap so that authentication will work as expected. Secondly we need to make the Cocoa applications behave as they should. Especially Terminal.app will currently misbehave. We know that the keyboard switching issue is not trivial since it requires consistent behavior in all native environments (BSD, Classic, Carbon, Cocoa, Java) which requires the integration of a unified keycode-to-character mapping function. We are confident that Apple will finish the integration for the public beta and we know that the problems, which we are experiencing in DP4, are due to the hybrid fashion of keyboard mapping which is still in place. Having said that ... lets go ahead and see whan can be done right now. Customizing the keymap menuWhen working with keymaps you need to edit your set of preferred mappings and input methods. They will show up as the last menu in your menu bar and depending on the system installation there might be more or less items. When you say "Configure menu..." you will end up in the Preferences application's "International" area. Reaching for the "Keyboard layouts" tab will always take a couple seconds since it seems like Mac OS X is scanning your disk to find all available mapping. When you do this for the very first time it will even present you some of the old NeXT-stlye keymaps which might by lying around on a different drive and some mappings will even show up twice. At that point it is a good idea to quit the Preferences and restart them again, because some of the presented items can be checked but will not be usable. This might result in a slightly confused system. On the second launch the set of offered keymappings should contain no duplicated entries and you are ready to start with the following procedures. Choosing a default keymappingJust selecting a keymapping from the menu does not make it the "true default". If you launch a new application it will start up with the US keyboard and not the one which you just selected in the Finder or any other application. In order to set a default keymapping you can use this workaround:
Now you should have only one keymapping and you should be able to add additional ones without affecting your preference. Each freshly started application will come up with your default mapping from now on. Fixing the Login PanelThe login panel is automatically started by the system after it has finished booting. For security reasons the owner of the process is the "root" user and all preferences and settings which the root user made do apply while you are in the login panel. One of them is the keyboard mapping. In order to get the keyboard mapping which matches your physical layout during the login process you must walk through the steps mentioned above while being logged in as "root". After that your login panel should behave as expected. Making Cocoa happyWhile under DP3 only the Cocoa keymappings could be controlled via the Preferences, DP4 does now only switch the Carbon side and thereby some application refuse to cooperate even after you have applied the described modifications. It seems like some parts of Cocoa have already been adjusted to use the low level subsystems of Carbon (TextEdit will usually get the right characters) while others have not been modified yet. The result is that command-key mapping in DP4 is not working as expected and Terminal.app, which knows how to steal keys and which probably does not use the regular NSTextView, will still stick to the default US layout. Fixing this final issue is possible via an old defaults setting which "hardwires" the layout to one of the still existing Openstep-style keymapping files. After you have found or copied over the right mapping you must type the following inside a shell window: defaults write NeXT1 Keymap /System/Library/Keyboards/Dvorak While this sounds easy it is quite a challenge because at this time the keyboard mapping in Terminal is still incorrect. So you probably are a lot faster if you type it into a fresh TextEdit document and then copy and paste into Terminal. For the "copy and paste" you might have use the menu items, because as you remember, at this time the command keys are still mapped incorrectly. A final logout and login will get you into DP4 with proper keyboard support so that your Dvorak keyboard will be supported the way you expect it. Now you are all set to start writing those Mac OS X killer applications. Going furtherIf or how this all works for Japanese or other non-Roman-languages which even require a different input manager is yet unknown. We would like to hear comments if there are issues which we did not cover in this article. For those who need to make adjustments to the predefined keyboard layouts we would like to suggest looking at the System.rsrc file in the Carbon.framework. Sadly we have not yet been able to make any changes with ResEdit inside this file without causing the system to hang during boot time. If you succeed ... let us know. |