What are the steps to setting up a custom keyboard layout in X11 without root access? I know it's possible, based on this answer, but I get Error loading new keyboard description whenever I try using my new layout.

In .config I have created a xkb directory as follows:


In my evdev-local.xml in the <layoutList> section I added


    <description>English (My US)</description>
        <description>English (Modified Programmer Dvorak)</description>

and the symbols/my-us file is

partial alphanumeric_keys
xkb_symbols "mdvp" {

    include "us(dvp)"
    name[Group1] = "English (Modified Programmer Dvorak)";

    //             Unmodified   Shift  AltGr        Shift+AltGr
    // upper row, left side
    key <AD01> { [ apostrophe,  quotedbl, dead_acute, dead_diaeresis    ] };

    // lower row, left side
    key <AB01> { [ semicolon,   colon, dead_ogonek, dead_doubleacute ] };

    include "level3(ralt_switch)"

I then run

setxkbmap -I ~/.config/xkb/ -rules evdev-local -layout my-us

and get

Error loading new keyboard description

Back story: I've been using Programmer's Dvorak, and I like it for the most part, but I want to switch the semicolon and apostrophe back to their positions on US Dvorak, since that works better for my workflow.

I have seen this tutorial recommended on SE, and it works on my machine, but I need to be able to use the KDE layout switcher widget so I can switch back to plain English QWERTY when someone else needs to work on my machine.

1 Answer 1


For some reason it works if you -print and pipe the output to xkbcomp:

setxkbmap \
    -I ~/.config/xkb/ \
    -rules evdev-local \
    -layout "my-us(mdvp)" \
    -print |
    xkbcomp -I ~/.config/xkb/ - "$DISPLAY"

I don’t think there is anything wrong with your layout. I tried setting it up with setxkbmap directly, but even with the -verbose option the output is not helpful:

Warning! Multiple definitions of rules file
         Using command line, ignoring X server
Warning! Multiple definitions of keyboard layout
         Using command line, ignoring X server
Trying to build keymap using the following components:
keycodes:   evdev+aliases(qwerty)
types:      complete
compat:     complete
symbols:    pc+my-us(mdvp)+inet(evdev)+terminate(ctrl_alt_bksp)
geometry:   pc(pc104)
Error loading new keyboard description

This is with the default verbose level. But even if I set it to 10, which is apparently the max level, it just outputs “locale is C” as well as where it tries to look for the rules file, in addition to the above. It does not output anything more about why it fails to load the keyboard description.

One of the reasons why I prefer to pipe to xkbcomp instead of just using setxkbmap is because the former seems to give better error messages.

  • That does not completely answer the question: If I try to run setxkbmap -print afterward, this will not show the right settings ! In my case I really need the setxkbmap settings to be modified :(
    – rambi
    Commented Jul 15, 2021 at 11:57

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .