2

I created a custom keyboard layout (the file is called “brc”) based on Colemak for my Lubuntu 18.04, and copied it to /usr/share/X11/xkb/symbols:

default partial
xkb_symbols "basic" {
    name[Group1]= "brc";

    // Alphanumeric section
    key <TLDE> { [   apostrophe,        quotedbl,        notsign,          notsign ] };
    key <AE01> { [            1,          exclam,    onesuperior,   exclamdown ] };
    key <AE02> { [            2,              at,    twosuperior,          onehalf ] };
    key <AE03> { [            3,      numbersign,  threesuperior,    threequarters ] };
    key <AE04> { [            4,          dollar,       sterling,       onequarter ] };
    key <AE05> { [            5,         percent,           cent,     threeeighths ] };
    key <AE06> { [            6,  dead_diaeresis,        notsign,        diaeresis ] };
    key <AE07> { [            7,       ampersand,      braceleft,     seveneighths ] };
    key <AE08> { [            8,        asterisk,    bracketleft,        trademark ] };
    key <AE09> { [            9,       parenleft,   bracketright,        plusminus ] };
    key <AE10> { [            0,      parenright,     braceright,           degree ] };
    key <AE11> { [        minus,      underscore,         endash,     questiondown ] };
    key <AE12> { [        equal,            plus,        section,      dead_ogonek ] };
    key <AE13> { [ bracketright,      braceright,      masculine,        masculine ] };
    key <BKSP> { [    BackSpace,       BackSpace,      BackSpace,        BackSpace ] };

    key <AD01> { [            q,               Q,          slash,            slash ] };
    key <AD02> { [            w,               W,       question,         question ] };
    key <AD03> { [            f,               F,       EuroSign,         EuroSign ] };
    key <AD04> { [            p,               P,          thorn,            THORN ] };
    key <AD05> { [            g,               G                                   ] }; 
    key <AD06> { [            j,               J,            yen                   ] };
    key <AD07> { [            l,               L                                   ] };
    key <AD08> { [            u,               U                                   ] };
    key <AD09> { [            y,               Y,         oacute,           Oacute ] };
    key <AD10> { [     ccedilla,        Ccedilla,                                  ] };
    key <AD11> { [   dead_acute,      dead_grave,         acute,             grave ] };
    key <AD12> { [  bracketleft,       braceleft,    ordfeminine,      dead_macron ] };

    key <AC01> { [            a,               A,             ae,               AE ] }; 
    key <AC02> { [            r,               R,     registered,       registered ] };
    key <AC03> { [            s,               S                                   ] };
    key <AC04> { [            t,               T                                   ] };
    key <AC05> { [            d,               D                                   ] };
    key <AC06> { [            h,               H                                   ] };
    key <AC07> { [            n,               N                                   ] };
    key <AC08> { [            e,               E                                   ] };
    key <AC09> { [            i,               I                                   ] };
    key <AC10> { [            o,               O,             oe,           OE     ] };
    key <AC11> { [   dead_tilde, dead_circumflex,     asciitilde,     asciicircum  ] };
    key <AC12> { [        slash,        question,   questiondown                   ] };

    key <AB01> { [            z,               Z,  guillemotleft                   ] };
    key <AB02> { [            x,               X, guillemotright                   ] };
    key <AB03> { [            c,               C       copyright,        copyright ] }; 
    key <AB04> { [            v,               V                                   ] }; 
    key <AB05> { [            b,               B                                   ] };
    key <AB06> { [            k,               K                                   ] };
    key <AB07> { [            m,               M,             mu,               mu ] };
    key <AB08> { [        comma,            less                                   ] };
    key <AB09> { [       period,         greater                                   ] };
    key <AB10> { [    semicolon,           colon                                   ] }; 

    key <SPCE> { [        space,           space,          space,     nobreakspace ] };

// Configures the "," for the numeric keypad
    include "kpdl(comma)"

// Configures the use of the AltGr key
    include "level3(ralt_switch)"
};

I also altered the following files in /usr/share/X11/xkb/rules:

in evdev.xml

    <layout>
      <configItem>
        <name>brc</name>
        <shortDescription>custom-clmk</shortDescription>
        <description>custom-colemak-abnt2</description>
        <languageList>
           <iso639Id>por</iso639Id>
        </languageList>
      </configItem>
      <variantList/>
    </layout>

in evdev.lst

! layout
  brc             abnt2+colemak

And this is the result:

~$ setxkbmap -v brc
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+brc+inet(evdev)
geometry:   pc(pc105)
Error loading new keyboard description

Also, this is my current layout:

~$ setxkbmap -v
Trying to build keymap using the following components:
keycodes:   evdev+aliases(qwerty)
types:      complete
compat:     complete
symbols:    pc+br+inet(evdev)
geometry:   pc(pc105)

How can I make xkb recognize my custom layout?

2

3 Answers 3

1

There appears to be a comma after Ccedilla that breaks the defition for AD10 if you only want to set two levels. The other keys for which you also only set two levels seems fine.

Also missing a comma in AB03 between C and copyright.

    key <AD10> { [     ccedilla,        Ccedilla                                   ] };
    //    ...
    key <AB03> { [            c,               C,      copyright,        copyright ] }; 
...
3
  • Sorry for the late reply. I corrected that mistake, but the same error still happens.
    – ssL
    Jun 24, 2021 at 12:05
  • 1
    ah, there was one further issue, missing a comma in key <AB03>... now it should work. see the edit Jun 24, 2021 at 12:22
  • That fixed the problem!
    – ssL
    Jun 24, 2021 at 12:26
0

I decided to try Xmodmap to remap my keyboard layout instead of XKB, and it worked perfectly. Creating custom layouts in XKB just seems to be too complex compared to Xmodmap, and I recommend Xah Lee's tutorial on the latter. Thanks for your help.

0

For those who want to try the corrected layout:

default partial
xkb_symbols "basic" {
    name[Group1]= "brc";

    // Alphanumeric section
    key <TLDE> { [   apostrophe,        quotedbl,        notsign,          notsign ] };
    key <AE01> { [            1,          exclam,    onesuperior,   exclamdown ] };
    key <AE02> { [            2,              at,    twosuperior,          onehalf ] };
    key <AE03> { [            3,      numbersign,  threesuperior,    threequarters ] };
    key <AE04> { [            4,          dollar,       sterling,       onequarter ] };
    key <AE05> { [            5,         percent,           cent,     threeeighths ] };
    key <AE06> { [            6,  dead_diaeresis,        notsign,        diaeresis ] };
    key <AE07> { [            7,       ampersand,      braceleft,     seveneighths ] };
    key <AE08> { [            8,        asterisk,    bracketleft,        trademark ] };
    key <AE09> { [            9,       parenleft,   bracketright,        plusminus ] };
    key <AE10> { [            0,      parenright,     braceright,           degree ] };
    key <AE11> { [        minus,      underscore,         endash,     questiondown ] };
    key <AE12> { [        equal,            plus,        section,      dead_ogonek ] };
    key <BKSL> { [ bracketright,      braceright,      masculine,        masculine ] };
    key <BKSP> { [    BackSpace,       BackSpace,      BackSpace,        BackSpace ] };

    key <AD01> { [            q,               Q,          slash,            slash ] };
    key <AD02> { [            w,               W,       question,         question ] };
    key <AD03> { [            f,               F,       EuroSign,         EuroSign ] };
    key <AD04> { [            p,               P,          thorn,            THORN ] };
    key <AD05> { [            g,               G                                   ] }; 
    key <AD06> { [            j,               J,            yen                   ] };
    key <AD07> { [            l,               L                                   ] };
    key <AD08> { [            u,               U                                   ] };
    key <AD09> { [            y,               Y,         oacute,           Oacute ] };
    key <AD10> { [     ccedilla,        Ccedilla                                   ] };
    key <AD11> { [   dead_acute,      dead_grave,         acute,             grave ] };
    key <AD12> { [  bracketleft,       braceleft,    ordfeminine,      dead_macron ] };

    key <AC01> { [            a,               A,             ae,               AE ] }; 
    key <AC02> { [            r,               R,     registered,       registered ] };
    key <AC03> { [            s,               S                                   ] };
    key <AC04> { [            t,               T                                   ] };
    key <AC05> { [            d,               D                                   ] };
    key <AC06> { [            h,               H                                   ] };
    key <AC07> { [            n,               N                                   ] };
    key <AC08> { [            e,               E                                   ] };
    key <AC09> { [            i,               I                                   ] };
    key <AC10> { [            o,               O,             oe,           OE     ] };
    key <AC11> { [   dead_tilde, dead_circumflex,     asciitilde,     asciicircum  ] };

    key <LSGT> { [    backslash,             bar,      masculine                   ] };
    key <AB01> { [            z,               Z,  guillemotleft                   ] };
    key <AB02> { [            x,               X, guillemotright                   ] };
    key <AB03> { [            c,               C,      copyright,        copyright ] }; 
    key <AB04> { [            v,               V                                   ] }; 
    key <AB05> { [            b,               B                                   ] };
    key <AB06> { [            k,               K                                   ] };
    key <AB07> { [            m,               M,             mu,               mu ] };
    key <AB08> { [        comma,            less                                   ] };
    key <AB09> { [       period,         greater                                   ] };
    key <AB10> { [    semicolon,           colon                                   ] };
    key <AB11> { [        slash,        question,   questiondown                   ] };

    key <SPCE> { [        space,           space,          space,     nobreakspace ] };

    key <KPPT> { [ period ] };

// Configures the "," for the numeric keypad
    include "kpdl(comma)"

// Configures the use of the AltGr key
    include "level3(ralt_switch)"
};

You must log in to answer this question.

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