2

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:

xkb/
  rules/
    evdev-local
    evdev-local.lst
    evdev-local.xml
  symbols/
    my-us

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

<layout>
  <configItem>
    <name>my-us</name>

    <shortDescription>my-us</shortDescription>
    <description>English (My US)</description>
    <languageList>
      <iso639Id>eng</iso639Id>
    </languageList>
  </configItem>
  <variantList>
    <variant>
      <configItem>
        <name>mdvp</name>
        <description>English (Modified Programmer Dvorak)</description>
      </configItem>
    </variant>
  </variantList>
</layout>

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.

0

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.

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.