Pepe Manshon
Timish

Kubuntu: Phonetic language to layout with Setxkbmap

30 October 2011 329 views 0 comments 0 recommendations tags: linux, kubuntu

There's something very annoying in upgrading an OS, no matter how good it is (and I'm speaking the new Kubuntu 11.10 here).

Usually the whole thing ends up in crashing GUIs, constant conflicts between new drivers and video card, non-working flash content, missing keyboard layouts and so many more.

Here's nice and simple fix to the missing phonetic layout in KDE Control Module for the keyboard.

Keyboard - KDE Control Module

Open terminal and execute the following command:

setxkbmap -model pc101 -layout us,bg -variant ,phonetic -option grp:alt_shift_toggle

This should automatically add the new layout and set it ready for use. Basically setxkbmap is a tool to set the keyboard using the X Keyboard Extension. The way it maps the keyboard to certain layout is via options, variants and other components, specified in the command line. All components of XKB keymap are stored in /usr/share/X11/xkb. For more info, regarding setxkbmap use:

man setxkbmap

To open the xkb file and check its components use:

nano /usr/share/X11/xkb/rules/evdev.lst
XKB model

Make sure you use the correct model of your keyboard (in most cases it would be pc101 to pc105).You can also check this under Keyboard KDE Control Module -> Keyboard Settings -> Hardware. Once you've determined the model find out the name of the layout you want (in this case it's bg for Bulgarian, alongside us for English).

Keyboard layout variant

The variant component represents the exact variation of the language we want to add as new layout to the keyboard. In this case I use phonetic for Bulgarian (bg).

The last important thing is to specify what key shortcut to use for switching between different layouts. This is done with an option, called grp, that can use different combinations such as right/left Alt, Caps Lock, Alt+Ctrl and many more:

Switch between layouts

If you don't feel like typing the same command every time you start your machine, you could create a shell script and execute it automatically on startup:

!#/bin/bash
setxkbmap -model pc101 -layout us,bg -variant ,phonetic -option grp:alt_shift_toggle
exit 0
and save it as, say xkb_layouts.sh under /Documents or wherever you want.
Shell script to set xkb map
Comments

Yes... under construction :(