github twitter linkedin
Custom keyboard layouts in Cinnamon
2017-12-03

I’m using a US keyboard, but my native language is german. Sometimes I have to write the dreaded german umlauts (ö ü ä ß) and I don’t want to switch only for that to a german keyboard. Turns out that Linux is flexible enough so that you can remap some keys on the US layout to produce the umlauts.

Some other people on the internet also had these problems. This GitHub repository contains a keymap which maps the umlauts to [Right Alt Key] + [o, u, a, s] and some other cool combinations. Installing this worked fine out of the box.

Cinnamon, my desktop environment, provides a keyboard layout switcher applet. But the available keyboard layouts don’t include the newly installed layout (it’s called “USA - German developers”). So where does the list the applet shows you come from?

After reading this great article on xkb it finally clicked. The applet parses the /usr/share/X11/xkb/rules/evdev.xml file to display the list. You just have to add the new layout (the xkb variant for the layout us is called dev-de) to that file.

Search for

<layout>
  <configItem>
    <name>us</name>

and put

<variant>
  <configItem>
    <name>dev-de</name>
    <description>English (USA - German developers)</description>
    <languageList>
      <iso639Id>ger</iso639Id>
      <iso639Id>eng</iso639Id>
    </languageList>	
  </configItem>
</variant>

in the <variantList> element of the us layout. Now the Cinnamon keyboard applet should let you choose “English (USA - German developers)” as your keyboard layout.

If you’re using XFCE instead of Cinnamon, this does essentially the same in XFCE.


Back to posts