I'm trying to create a custom layout in XKB following instructions given in stack exchange answers and other tutorials. I have the following in the file my:

default alphanumeric_keys
xkb_symbols "basic" {

  name[Group1]="MyLayout";

  key <AC01> { [ UE700 ] };
  key <AC02> { [ UE701 ] };
  key <AC03> { [ UE702 ] };
  key <AC04> { [ UE703 ] };
  key <AC05> { [ UE704 ] };
  key <AC06> { [ UE705 ] };
  key <AC07> { [ UE706 ] };
  key <AC08> { [ UE707 ] };
  key <AC09> { [ UE708 ] };
  key <AC10> { [ UE709 ] };
  key <AC11> { [ UE70A ] };
  key <AD03> { [ UE70B ] };
};

I added blocks to the evdev.lst and evdev.xml files:

// evdev.lst
! layout
  my              MyLayout
  us              English (US)

// evdev.xml
<layout>
    <configItem>
        <name>my</name>
        <shortDescription>my</shortDescription>
        <description>MyLayout</description>
        <languageList>
            <iso639Id>myl</iso639Id>
        </languageList>
    </configItem>
    <variantList/>
</layout>

I ran sudo dpkg-reconfigure xkb-data prior to testing. The layout is visible in my system settings as MyLayout and I can add it with no apparent issue. However, when I select it as the active layout, its symbol is dark gray and it behaves like the layout immediately before it in the dropdown list. If my list goes English (US), Hebrew, MyLayout, my custom layout will behave exactly like the Hebrew layout. If I remove Hebrew, it will behave exactly like English (US). I'm fresh out of ideas on this and am not seeing an issue with my syntax.

locale is C
Warning! Multiple definitions of keyboard layout
         Using command line, ignoring X server
Trying to load rules file ./rules/evdev...
Trying to load rules file /usr/share/X11/xkb/rules/evdev...
Success.
Applied rules from evdev:
rules:      evdev
model:      pc105
layout:     my
variant:    basic
options:    compose:ralt,lv3:caps_switch
Trying to build keymap using the following components:
keycodes:   evdev+aliases(qwerty)
types:      complete
compat:     complete
symbols:    pc+my(basic)+inet(evdev)+compose(ralt)+level3(caps_switch)
geometry:   pc(pc105)
xkb_keymap {
    xkb_keycodes  { include "evdev+aliases(qwerty)" };
    xkb_types     { include "complete"  };
    xkb_compat    { include "complete"  };
    xkb_symbols   { include "pc+my(basic)+inet(evdev)+compose(ralt)+level3(caps_switch)"    };
    xkb_geometry  { include "pc(pc105)" };
};
  • what did you add in evdev to go along with your evdev.{lst,xml} entries? the lst/xml files are only descriptions, evdev is where the rules to load your layout are defined. – quixotic Mar 25 '17 at 18:21
  • aha, that must be my issue. I added nothing. Looking at it now, the syntax is not clear to me. I'm guessing I want to add the line * my = +???, where ??? is some mumbo jumbo I'm not following – Alex Clough Mar 25 '17 at 18:25
  • Your my file only defines a few keys. Possibly the fact that it's incomplete matters. You may want to try to add include "us(basic)" before your key definitions. – Gunnar Hjalmarsson Mar 25 '17 at 19:24
up vote 1 down vote accepted

You need to add the actual rule in /usr/share/X11/xkb/rules/evdev; the evdev.{lst,xml} files are only descriptions.

My best guess is that you need something like the following:

# existing lines
! model         layout          variant         =       symbols
  *             ben             basic           =       pc+in(ben)
# your additions
  *             my              basic           =       pc+my(basic)

I'm assuming your my file is /usr/share/X11/xkb/symbols/my. The first 3 columns are matching XKB input parameters (here, any -model, -layout my, -variant basic). The last column defines the symbols rule in terms of symbol files to load, in the format file(clause) (multiple files separated by +). Symbol files are all in /usr/share/X11/xkb/symbols.

Try that -- you can test with something like this to make sure it's working (note the +my(basic) in the xkb_symbols line):

$ setxkbmap -layout my -variant basic -print
xkb_keymap {
        xkb_keycodes  { include "evdev+aliases(qwerty)" };
        xkb_types     { include "complete"      };
        xkb_compat    { include "complete"      };
        xkb_symbols   { include "pc+my(basic)+inet(evdev)"     };
        xkb_geometry  { include "pc(pc105)"     };
};

One problem is that I'm not sure your my definitions won't conflict with an existing layout. If this is a completely new layout, you should probably call it something else to avoid conflicts.

  • Okay, this is informative, but the modification to evdev doesn't cause any change in behavior. Do I also have to edit base and base.{lst/xml}? – Alex Clough Mar 25 '17 at 18:55
  • no, evdev is the current rules in use. can you see the changes with the setxkbmap command i've shown? if so the new rule is working. if not try again with -verbose 10 and update your question with the output. – quixotic Mar 25 '17 at 18:57
  • It looks like the symbols are being included – Alex Clough Mar 25 '17 at 19:07
  • @AlexClough ok that output looks pretty sane. the -print makes it a simple test (good first step!). run setxkbmap -query to see your current settings then add your new layout to it (should look like setxkbmap -layout us,my -variant ,basic -option compose:ralt,lv3:caps_switch or some such -- without -print it will try to load the layout). – quixotic Mar 25 '17 at 19:11
  • silence on the command line. Should that command have caused the layout to appear in the selection dropdown? Might it be relevant that the unicode points I included in the layout are in a private use area? – Alex Clough Mar 25 '17 at 19:15

Your Answer

 

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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