As I recently decided to switch to Ubuntu, I needed a custom keyboard layout with both Romanian special characters (ă, â, î, ț, ș) and the German ones also (ä, ö, ü, ß), so I won’t be forced to switch between layouts all the time. This example can be used also to edit other layouts and create your own custom keyboard.

My keyboard looks like this:

How I’ve accomplished this:

In this case it’s necessary to edit two files:

/usr/share/X11/xkb/rules/evdev.xml
/usr/share/X11/xkb/symbols/ro

In the first file, “/usr/share/X11/xkb/rules/evdev.hml”, we search for the begining of Romanian keyboard, and insert our layout as a new “<variant>…</variant>” like this: