This note is based on my personal (and limited) experience with the open source implementation of the X Window under GNU/Linux. I use in the following examples the Fedora distribution.
For a general introduction to the configuration of the keyboard in the X Window system see Doug Palmer's An Unreliable Guide to XKB Configuration. See also M. Kosmulski, Creating custom keyboard layouts for X11 using XKB.
My note is also “unreliable”, but I count on the judgment of the reader and X Window's and GNU/Linux's flexibility.
The first thing you need to know is the location of the files of the X Window System on your computer. I a terminal type the following command:
locate xkb | less
You need less because there will be a lot of files with xkb in their names. You do not need it when there is no working X server. In this image you see the example of a system which has no working X Window. In such a system you use only the command line and TUIs (text user interfaces).
There might be various locations of the xkb folder. These are three images with the cases of SUSE, Fedora Core 4 and Fedora 7.
In Fedora Core 4 we will concentrate our interest on
/usr/X11R6/lib/X11/xkb/symbols/pc/
In Fedora 7 we will concentrate on
/usr/share/X11/xkb/symbols/
In these folders there is file called “ro”. Open it with Vim or another editor (not as root !!!). It is a text file. You find there the definitions for the Romanian keyboard. Copy it to a safe place, before you make any changes.
I will assume that you have installed only the US keyboard.
You can obtain an image of the installed keyboard with the following commands:
xkbcomp -xkm $DISPLAY
xkbprint -eps -color -fit -ll 2 -level2 server-0_0.xkm
The result is an eps-file. It is an image similar to this one.
Then try to see if the following commands work:
setxkbmap us -print | xkbcomp - $DISPLAY
setxkbmap -v us
They should work! They generate a number of warnings, but they should not generate errors. After all, I assume that you do have a functioning US keyboard.
Pay attention to this line in the message issued after the last command:
symbols: pc(pc105)+us+level3(ralt_switch_for_alts_toggle)+group(alts_toggle)
We will meet level3 again later.
Now you know what you need to know from the configuration of the keyboard in the case of the X Window.
In Fedora and other GNU/Linux distributions a standard Romanian keyboard is installed by default. You can switch to it from the command line:
setxkbmap us
I tried to use the standard Romanian keyboard, but I do not feel at ease with it.
How can you create your personal keyboard? Look carefully through the files in
/usr/X11R6/lib/X11/xkb/symbols/pc/
or
/usr/share/X11/xkb/symbols/
and use them as a model. I have worked with latin. Romanian uses the latin alphabet and this is a normal choice. This is a text file and it is not difficult to understand how it is built. I have looked through the other files of the European languages and I have identified the names of the symbols I would like to put in my personal version of the keyboard.
I will describe first the experience with the personalized keyboard under Fedora Core 4 and then under Fedora 7.
The first step is to write a symbol file for Romanian. This is the file that I use under Fedora Core 4. You may download it.
For the next step you must be root. In fact, I would advise anyone to be root only in this step. Back-up the ro file from
/usr/X11R6/lib/X11/xkb/symbols/pc/
Then rename ro-fc4.txt (the downloaded file). Name it ro. Copy it (as root) in the folder indicated above.
I will describe next the similar procedure for Fedora Core 7, then I will discuss the effective use of the keyboard.
The first step is to write a symbol file for Romanian. This was the file that I first used under Fedora 7. You may download it. Its main characteristics is the use of a cedilla under s and t as diacritical marks.
This is the a new file for Fedora 7. You may download it. Its main characteristics is the use of a comma under s and t as diacritical marks. You still have the version with cedilla as AltGr+s or AltGr+t.
For the next step you must be root. Back-up the ro file from
/usr/share/X11/xkb/symbols/
Then rename ro-fc7.txt (the downloaded file or the file you have written). Name it ro. Copy it (as root) in the folder indicated above.
Try to see if
setxkbmap ro -print | xkbcomp - $DISPLAY
works. Then, if it works, switch with
setxkbmap -v ro
to the Romanian keyboard and test it. See if everything is OK. You can go back to the US keyboard with
setxkbmap us
When I tried to use the ro file from Fedora Core 4 under Fedora 7, I have got an error. After the command
setxkbmap ro -print | xkbcomp - $DISPLAY
there was an error message. The essential part was:
No Symbols named "ralt_switch_multikey" in the include file "level3"
Now, examine the ro file for Fedora Core 4! In its final part it includes a file called “level3”. There is a file called “level3” in Fedora 7, as we saw above, but it has no definition for "ralt_switch_multikey". That's why the the ro file for Fedora 7 is different in its final part.
I tried ralt_switch, from level3, but it inhibits Ctrl+Alt+F1 and all similar combinations of keys. Thus I put include "level3(ralt_switch_for_alts_toggle)" in the final part of the the ro file for Fedora 7.
Making sense of errors is very important. It is easier to do this with the command line. The GUI tends to have much more criptic error messages, because it is difficult to spot the exact command which caused the error(s).
Switch to the Romanian keyboard with
setxkbmap ro
Test it with Vim or another editor. The tests should give a result similar to this one. The old version is here.
There are four levels in the keyboard:
There are also the “dead keys”. Press RIGHT ALT+ a key on the line with numbers, then press a letter. You can get with this method accented letters, like à á è é and so forth.
Now it makes sense to set up a method for changing the keyboard from the graphical interface.
I prefer to use the GNOME desktop environment. In GNOME one can add to a panel the Keyboard Indicator (see the image).
Move the mouse to the Keyboard Indicator. Press the right button of the mouse. Then click on “Open Keyboard Preferences”. Use “Help” to learn more about the “preferences”. Press “Layouts” in order to add more keyboards.
Under Fedora 7 one adds the personalized Romanian keyboard in the following way:
Just press <em>Romania</em>; we have replaced the standard ro file and the other options are no longer available.
In the “Layout Options” I have selected:
With this options you can press LEFT WIN and change the keyboard. The change affects only the window in which you are working. You do not have to use the mouse and you can change easily between the US and the personal keyboard.