I've been using for years my own custom made keyboard layout. It's fairly easy to create and use a new layout. However I frequently reinstall my system and each time I do, I need to add my custom layout again and again.

I want to know is it possible to keep my files somewhere safe, for example, under my /home dir, instead of /usr/share? Ideally, I would love to be able to create only two files


and then have Xkb pick them up somehow. Here are my questions:

  • Is anything like this possible?
  • If yes, would I need to copy the entire evdev.xml file to my /home dir and then add my rule in it, or can I keep it clean and only have it contain my rule and no other (and have Xkb somehow integrate it with the existing /usr/share/X11/xkb/rules/evdev.xml)?
  • Would a different location be more suitable for these custom files? How about if I want multiple users to have access to the custom layout?
  • A bonus question: If I wanted to build my own .deb installation for my custom layout, what would be an ideal file and folder structure in this case? Where could it be installed so as not to affect the system files and not get overwritten during an upgrade/reinstall?

So far I've tried fiddling with the setxkbmap, but nothing seems to work the way I'd expect. I tried setting the -rules option, but my file isn't detected.

Thanks in advance.

2 Answers 2


I don't think it's possible to do what you want. There are a few possible approaches which are described in answers to other questions.

As regards a .deb file, one way is to write a patch with your customizations and build your own xkb-data package from a custom xkeyboard-config source.

In this PPA you find an example of patching xkeyboard-config including the exact debdiff compared to the source in the Ubuntu archive.

  • Gunnar thank you very much for the answer. Could you by any chance provide a link or two to any useful resources regarding xkb-data and xkeyboard-config? Nov 24, 2016 at 17:51
  • @ТомицаКораћ: I edited the answer. Nov 24, 2016 at 18:02

You can compile a modified configuration. I did a similar thing here: https://askubuntu.com/a/794087/514921.

Basically the idea is to print the existing configuration, add references to your local additions via e.g. sed, and compile the result. Do this in a script that is run at login. None of the commands require root access.

  • A very interesting approach, thanks. This does what I asked for, more or less. But since it's more of a work-around than a solution, I'm not sure if I should accept it as an answer. Feb 5, 2017 at 23:42
  • Unfortunately xkb doesn't seem to be designed for easy per-user extension, so I think a work-around is about the best you can do. I would love to be proven wrong of course.
    – ergosys
    Feb 6, 2017 at 4:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.