Switching Keyboard Layout in Solaris
By Petr Hruska on Dec 19, 2007
1) Switching Keyboard Layout in Solaris using IIIMF
Constrains: JDS/CDE desktop, UTF-8 locale IIIMF - Internet Intranet Input Method Framework is openi18n.org project used by Solaris to provide national characters input originally targeted for Asian languages and designed by Hideki Hiura. Recently also support for European keyboards was added so this framework is covering all languages now. You can find European keyboard support there in OpenSolaris, Solaris Express Community and Developer Edition >b57 and Solaris 10 8/07.
To switch the keyboard layout look at Input Method Preference Editor (accessible by default from the panel clicking on Input Method Switcher applet or from terminal "$ iiim-properties"
In the Input Method Preference Editor you can customize the list of required keyboard layouts
Once you have added layouts you need you can start using them. To switch to wanted layout select it in Input Method Switcher applet. The layout must be activated (use ctrl+space shortcut to activate/deactivate) otherwise default Xserver setting is used. You can easily recognize the layout is activated when "keyboard" keyword is displayed on the panel next to layout code.
If keyboard layout or input method is not activated the default Xserver is used. I recommend to not set anything regarding to keyboards and to use US-English layout as the default one. But it may happen you have selected the keyboard layout during installation process or you configured keyboard layout on the Xserver side. This couldn't cause problems, but if yes go again to Input Method Preference Editor and double check the setting if Xserver keyboard layout autodetection is correct. If not disable the autodetection and select your layout manually.
Switching Keyboard Layout in Solaris setting up the Xserver
In case you are working in non UTF-8 locale or using other window manager than JDS/CDE you will need to configure your Xserver to switch to keyboard layout. Solaris is using Xorg xserver on x86 and Xsun on Sparc, but in general both Xservers are available on both platforms, well the Xorg is the preferred one. There is couple of ways how to switch the layout.
If you don't need switching between keyboard layouts on the fly and you just need to set one permanently
you can use "kbd -s" utility:To pick up a layout you need to restart your Xserver (logout/login).
bash-3.2$ kbd -s
1. Albanian 22. Latvian
2. Belarusian 23. Macedonian
3. Belgian 24. Malta_UK
4. Bulgarian 25. Malta_US
5. Croatian 26. Norwegian
6. Czech 27. Polish
7. Danish 28. Portuguese
8. Dutch 29. Russian
9. Finnish 30. Serbia-And-Montenegro
10. French 31. Slovenian
11. French-Canadian 32. Slovakian
12. Hungarian 33. Spanish
13. German 34. Swedish
14. Greek 35. Swiss-French
15. Icelandic 36. Swiss-German
16. Italian 37. Taiwanese
17. Japanese-type6 38. TurkishQ
18. Japanese 39. TurkishF
19. Korean 40. UK-English
20. Latin-American 41. US-English
To select the keyboard layout, enter a number [default 41]:
In most of case you need to switch between keyboard layouts on the fly. This is possible only on Xorg. You need to make manual setup in xorg.conf (/etc/X11/xorg.conf). If you don't have xorg.conf you have to create it. Again there is more options:
1) run "/usr/X11/bin/xorgconfig" -- interactive setting
2) run "/usr/X11/bin/Xorg -configure" -- non interactive
Once you have the xorg.conf you can customize it. Open it and look at the keyboard section. You should have something similar to below example there:
# vi /etc/X11/xorg.confSuch settings enables you to toggle between US-English, German, Spanish keyboard layouts on the fly using defined shortcut. In shown example I use both shift keys. You can look at An Unreliable Guide to XKB Configuration written by Doug Palmer (http://www.charvolant.org/~doug/xkb/html/index.html) if you are interested in Xorg keyboard settings.
Option "XkbRules" "xorg"
Option "XkbModel" "sun_type6_euro_usb"
Option "XkbLayout" "us,de,es"
Option "XkbOptions" "grp:shifts_toggle"
Switching Keyboard Layout in Solaris - Compose Key
If you don't need necessarily complete keyboard layout but need just time to time to input a special national character there is a compose key in Solaris. Some keyboards (e.g. Sun Type USB) have this key physically for other keyboards the compose key is mapped to the "menu key". The Compose key sequence is used to input characters with diacritical marks and other characters that are not shown on the keyboard key caps.
Mark Compose Key Combination Example Dieresis A Compose A “ —> A with diaeresis Ä Caron v Compose Z v —> Z with caron Ž Breve u Compose G u —> G with breve Ğ Registered Sign Compose R O —> Registered sign ® Copyright Sign Compose c o —> Registered sign © Inv. Exclamation Mark Compose ! ! —> Inv. Exclamation Mark ¡
To see all possible combinations look at Solaris 10 International Language Support Collection >> International Language Environments Guide (http://docs.sun.com/app/docs/doc/817-2521?l=en) or this is directly defined for each locale in /usr/openwin/lib/locale/