Switching keyboards in OpenSolaris using setxkbmap and keyboard shorcuts
By Petr Hruska on Jan 07, 2009
As current OpenSolaris 2008.11 binary distro have several options how to change keyboard layouts, there are still some issues reported by users which are a bit confused about Input Method Switcher GUI, which is default tool to switch between various input methods and keyboard layouts. From any reason if you're not satisfied with the tool or keyboard layout there is not the one you need there is still option which can bring all the comfort of switching between keyboard layouts using your preferred shortcut.
The solution is based on setxkbmap utility and desktop shortcuts. OpenSolaris is using GNOME by default by almost all other window managers provide possibility to create custom keyboard shortcut, which is all what is needed.
Below steps gives example how to set up keyboard switching for GNOME:
1. Run Main Menu -> System -> Preferences -> Keyboard Shortcuts or run from terminal "gnome-keybinding-properties"
2. In Keyboard Shortcut dialog click on "New" Custom Shortcut
3. Type in following New Command e.g. "/usr/X11/bin/setxkbmap cz_qwerty" to get Czech layout
4. In Custom Shortcuts list there is your new item now so edit your preferred shortcut
5. Close the dialog .. any time you press your shortcut layout will change to Czech
If you would like to switch between more layouts simply add more custom shortcuts using setxkbmap e.g. to switch to US/English use "/usr/X11/bin/setxkbmap us" etc ..
You can use various options with setxkbmap command. If you look into /usr/X11/lib/X11/xkb/symbols you can see source keyboard files, but also some subdirectories like sun, macintosh or pc. Those are used by various vendors to place their keyboard standars in. So if you would like to have such keyboard variant you can easily add parameter to setxkbmap command to use it e.g "/usr/X11/bin/setxkbmap -model sun de". Basic usage of setxkbmap is as simple as "usr/X11/bin/setxkbmap <layout_code>". To find out whats the layout_code you need look in /usr/X11/lib/X11/xkb/symbols where all the keyboard maps are placed and use the file name as a layout code. For all options of setkxbmap please consult its man pages.