Keyboard Layout – Steps to Create a New Keyboard Layout

keyboard-layout

The keyboard I am trying to create has a lot of Unicode and looks like this:
The keyboard I am trying to create

Being unsuccessful with the following tutorial:

I was wondering if anybody would be so kind to provide a better tutorial with step by step instructions?

Best Answer

In Ubuntu 14.04, keyboard layouts are kept in

/usr/share/X11/xkb/symbols/


Each of the files in this directory contains a series of entries of the following type:

    key <AC01> {[a, A, aacute, Aacute]};

This entry maps a key on the keyboard to a number of specific characters using the following conventions:

  1. <A C01> The first letter A indicates we are looking in the alphanumeric key block (other options include KP [for keypad] and FK [for Function Key]);

  2. <A C 01> The second letter C indicates the row, counting from the bottom in which the key is found. (In a standard US keyboard, the space bar is in row AA and the number keys are in row AE).

  3. <AC 01> The numbers 01 indicates the position of the key, counting from the left and ignoring any specially named key like TAB or ~ (tilde): AC01 is in the third row up, first key over from the left (ignoring Caps Lock, if present); on a standard US keyboard, this is the key marked “a”.

  4. The brackets enclose the list of characters assigned to each key. This contains up to four entries, separated by commas:

    1. a - The unmodified key.
    2. A - The Shift character.
    3. á - The Alt Gr character. (aacute)
    4. Á - The Shift+Alt Gr character. (Aacute)

Creating a custom keyboard map is as easy as replacing the characters you don’t want in a given line with the ones you do!

For example:

As an Anglo-Saxonist, I type á and Á much less frequently than I type æ and Æ.

To add the Anglo-Saxon characters to my list, I simply replace aacute and Aacute with the entity names or Unicode code points for æ and Æ (“aelig” or U00E6 and “AElig” or U00C6, respectively):

    key  {[a, A, aelig, AElig]};

or

    key  {[a, A, U00E6, U00C6]};

When I am finished modifying my keyboard layout, I save the file with a new name, "oe" in the same directory.

Adding a new keyboard layout to evdev.xml file.

In order to use new keyboard layout, We need to tell X11 that it exists. In Ubuntu 14.04 X11 keeps track of installed keyboards in /usr/share/X11/xkb/rules/evdev.xml file. Then lets add the new layout in it.

  1. Open X11/xkb/rules/evdev.xml in an editor
  2. Go to the end of the <layoutList> section (search for </layoutList>). Add the following after the last </layout> tag, where X is the file name of your keyboard layout in /usr/share/X11/xkb/symbols (in my case oe); Y a suitable short name; and Z an appropriate long name in one or more languages and aaa a legal three letter (ISO 639-2) language code (e.g. eng for English):

    <layout>
     <configItem>
       <name> X </name>
       <shortDescription> Y </shortDescription>
       <description> Z </description>
       <languageList>
          <iso639Id> aaa </iso639Id>
       </languageList>
     </configItem>
     <variantList/>
    </layout>
    

Here it is, follow complete introduction

Other related links:
http://ubuntuforums.org/showthread.php?t=188761&p=1092145#post1092145 http://www.charvolant.org/~doug/xkb/html/index.html