Custom keyboard tweaks in 2017 for Ubuntu

Linux for the desktop changes with every year going by. So does the ability to change the keyboard layout. For many years, xmodmap was the way to go, if a Linux user wanted to alter the configuration of his or her keyboard. This is what I did, a few years ago, when I slightly altered my FRench keyboard layout to invert A with Q, J with O and K with E as described in one of my previous posts: Custom keyboard layouts on Linux and the jokeft version.

If wondering why such a change would be of any benefit at all, here is the heatmap of using the virtual keyboard of an Android phone after about 3000 words typed in a mix of French, Romanian and English (as provided by SwiftKey):


It is easy to see that A sees more use than Q, and that K and J are much less frequently used than E or O. Now, how can we change the keyboard layout on Linux, when xmodmap is no longer an option ?

It is both easy and complicated. Easy, because we only need to alter two text files, and complicated, because the alterations require reading and understanding, at least partially, what the manager of the keyboard, xkb, does. Of great help for the tweaks I describe was a post by Michał Kosmulski (

The recipe was only tested on Ubuntu 16.04 and Ubuntu 17.04, and if you use another Linux system, the path to the files to modify might be different. In my case, I modified the file that contains the correspondence between the physical keyboard and the characters that are sent to the system through xkb. For my french keyboard, all the different layouts are found in the fr text file in the folder:


Make sure to keep a copy of the original file somewhere, if something goes wrong with the tweaks. Since I was only making small changes to the layout, I modified the original file by adding the following section at the end:

// My own keyboard changes
partial alphanumeric_keys
xkb_symbols "latin9_jokeqa" {

    // Modifies the basic fr-latin9 layout to invert aq, ek, oj

    include "fr(latin9)"

    name[Group1]="French (legacy, alternative, invert aq, ek, oj)";
    key     { [   q,    Q,  acircumflex,    adiaeresis ] };
    key     { [   k,    K,     EuroSign,    cent ] };
    key     { [   j,    J,  ocircumflex,    odiaeresis ] };

    key     { [   a,    A,  Acircumflex,    Adiaeresis ] };
    key     { [   o,    O,  Ucircumflex,    Udiaeresis ] };
    key     { [   e,    E,  Icircumflex,    Idiaeresis ] };

The rows of the keyboard are A, B, C, D, from the space bar row, so that AD01 corresponds to the first character key in the fourth row (a, on the azerty French keyboard). To get an idea about what this layout change does (colored pairs correspond to the modified keys):


The unique identifier of this layout is xkb_symbols "latin9_jokeqa"

The name[Group1] value is important and describes the keyboard layout, as it will be seen by the different GUIs for regional settings in GNOME, KDE or XFCE, here “French (legacy, alternative, invert aq, ek, oj)”.

Once the layout was defined, it needs to be referred in an xml description file, called evdev.xml, situated in a different folder:


Here, we need to insert the information that was specific to the newly defined tweak to the keyboard layout in the following form:

 <description>French (legacy, alternative, invert aq, ek, oj)</description>

Once the new files were saved in the original locations (as sudo), I’m not sure that the following command is required, but it could help:

sudo dpkg-reconfigure xkb-data

It helps also to reboot the system, because without a reboot, the keyboard indicator did not recognize the two versions of the keyboard.


That’s it. Compared with the xmodmap method, this one is persistent and works by default in KDE, GNOME and XFCE. It is also somewhat futureproof, as it should work with the Wayland protocol.

PPA repositories for Ubuntu 16.04

Here are a few repositories that I found useful for recent versions of programs on Ubuntu 16.04 LTS. Using them allow one to have stable recent versions of R, LibreOffice, MS Visual Studio, NodeJS or Zotero stand-alone.

deb xenial/ for R

deb xenial main for Thunderbird

deb xenial main for GNOME extension shell

deb [arch=amd64] stable main for VisualStudio

deb xenial main for NEOVIM

deb xenial main for NUMIX

deb xenial main for NODEJS

deb xenial main for XNVIEW and other GRAPHICS

deb xenial main for KUBUNTU

deb release restricted for SPIDEROAK

deb xenial main for LIBREOFFICE

deb xenial main for ZOTERO standalone

deb stable non-free #Opera Browser (final releases) for OPERA

deb xenial main for INKSCAPE

The list was obtained with a simple command line (from

grep -r --include '*.list' '^deb ' /etc/apt/sources.list /etc/apt/sources.list.d/

To add any of the PPAs to the list of available software sources:

sudo add-apt-repository ppa:<name of the PPA>

Installing a deb package can also automatically add a repository to the list. Some repositories are more complicated (example for Opera browser):

sudo add-apt-repository 'deb stable non-free'
wget -qO- | sudo apt-key add -