How one can create an installer for custom keyboard layout

I've managed to create a custom keyboard layout for my language.

Now that the keyboard is in a state that I can share it. I don't know how to make it a redistributable package.


Solution 1:

To add it to the official xkeyboard-config package, you would develop it as a patch for the xkeyboard-config package. See their code contribution guide; contributed layouts are made by patches on their bug tracker. You can clone the upstream repository with:

git clone git://anongit.freedesktop.org/git/xkeyboard-config
  • From a quick glance at your layout, I think you need to add the default keyword to the stanza definition (default xkb_symbols "basic"), to declare that layout the default for that file. Your file itself would be put in the symbols directory.

  • In addition to your new layout file, you'll need to add it to the rules templates (rules/base.xml.in or possibly rules/base.extras.xml.in -- the rules/evdev.xml file will be generated from the same template).

  • Doublecheck the project documentation for other specifics that I might have missed.


You could also add that patch to the Ubuntu source package apply it with the standard dpkg build tools. This would allow you to distribute your modifications to other Ubuntu users with minimal difficulty. See questions like How to create and maintain patch on Debian package? for more specifics.

Solution 2:

You can wrap your keyboard layout as a Debian package. This will create a .deb file which can be installed from the command line with sudo apt install -f ./my-file.deb or just by double-clicking the file in the file explorer.

I've done this and have published the work on GitHub. That repository contains really all you need to do this, but in the interest of having a self-contained answer here, I'll give an outline of the process.

Step zero, learn how to make a keyboard layout. You basically have to modify some configuration files in /usr/share/X11/xkb.

Then, learn how to make a Debian package. Our package's job is basically going to be to just modify the right files in the aforementioned xkb directory. However, if you try to do this, you'll find as I did that dpkg yells at you for trying to overwrite another package's files. You will need to get around this using diversions.