8

I have two custom keyboard layouts, one a modified version of the us (which I have called vi,) one a modified version of the dk (which I have called da.)

Both are registered properly, and work. After a fashion.

The vi has Capslock and Escape swapped identical to how it is done in the capslock(swapescape) partial layout, and has a specified Compose key (the <LSGT> key, which is unusued in us on a pc105, but used for <>\¬ with dk.)

(Obviously vi is one I made for Vi-like editors. The reason why I don't just set caps:swapescape, compose:102 is because that will also affect the dk layout — namely blotting out the ability to enter the symbols <>\¬.)

The problem I initially encountered was that my vi layout would swap Capslock and Escape, and that this would bleed over into the native dk layout.

Then I created the da layout which attempts to rectify this, by specifying that Capslock is indeed Capslock, and that Escape is indeed Escape.

And this almost works. Now they both act as Capslock when the da layout is selected.

How do I make sure Escape is Escape and Capslock is Capslock in da while retaining the swapped behavior in vi?

ETA: I have now tried to reverse the order of these two layouts (so the layouts read da,vi) and the error has promptly switched: now both of vi's are Capslock, and da has the normal way.


I am on Xubuntu 14.04

vi layout file:

default  partial alphanumeric_keys modifier_keys
xkb_symbols "basic" {

    name[Group1]= "English (US) with Caps:SwapEscape and Compose:102";

    key <TLDE> {    [     grave,    asciitilde  ]   };
    key <AE01> {    [     1,    exclam      ]   };
    key <AE02> {    [     2,    at      ]   };
    key <AE03> {    [     3,    numbersign  ]   };
    key <AE04> {    [     4,    dollar      ]   };
    key <AE05> {    [     5,    percent     ]   };
    key <AE06> {    [     6,    asciicircum ]   };
    key <AE07> {    [     7,    ampersand   ]   };
    key <AE08> {    [     8,    asterisk    ]   };
    key <AE09> {    [     9,    parenleft   ]   };
    key <AE10> {    [     0,    parenright  ]   };
    key <AE11> {    [     minus,    underscore  ]   };
    key <AE12> {    [     equal,    plus        ]   };

    key <AD01> {    [     q,    Q       ]   };
    key <AD02> {    [     w,    W       ]   };
    key <AD03> {    [     e,    E       ]   };
    key <AD04> {    [     r,    R       ]   };
    key <AD05> {    [     t,    T       ]   };
    key <AD06> {    [     y,    Y       ]   };
    key <AD07> {    [     u,    U       ]   };
    key <AD08> {    [     i,    I       ]   };
    key <AD09> {    [     o,    O       ]   };
    key <AD10> {    [     p,    P       ]   };
    key <AD11> {    [ bracketleft,  braceleft   ]   };
    key <AD12> {    [ bracketright, braceright  ]   };

    key <AC01> {    [     a,    A       ]   };
    key <AC02> {    [     s,    S       ]   };
    key <AC03> {    [     d,    D       ]   };
    key <AC04> {    [     f,    F       ]   };
    key <AC05> {    [     g,    G       ]   };
    key <AC06> {    [     h,    H       ]   };
    key <AC07> {    [     j,    J       ]   };
    key <AC08> {    [     k,    K       ]   };
    key <AC09> {    [     l,    L       ]   };
    key <AC10> {    [ semicolon,    colon       ]   };
    key <AC11> {    [ apostrophe,   quotedbl    ]   };

    key <AB01> {    [     z,    Z       ]   };
    key <AB02> {    [     x,    X       ]   };
    key <AB03> {    [     c,    C       ]   };
    key <AB04> {    [     v,    V       ]   };
    key <AB05> {    [     b,    B       ]   };
    key <AB06> {    [     n,    N       ]   };
    key <AB07> {    [     m,    M       ]   };
    key <AB08> {    [     comma,    less        ]   };
    key <AB09> {    [    period,    greater     ]   };
    key <AB10> {    [     slash,    question    ]   };

    key <BKSL> {    [ backslash,         bar    ]   };

    key <CAPS> { [ Escape ] };
    key <ESC>  { [ Caps_Lock ] };
    key <LSGT> { type[Group1]="TWO_LEVEL", [ Multi_key, Multi_key ] };
};

da layout file:

// based on a keyboard map from an 'xkb/symbols/dk' file

default  partial alphanumeric_keys
xkb_symbols "basic" {

    include "latin(type2)"

    name[Group1]="Danish";

    key <AE11>  { [      plus,   question,    plusminus, questiondown ] };
    key <AE12>  { [dead_acute, dead_grave,          bar,    brokenbar ] };


    key <AC10>  { [        ae,        AE,   dead_acute, dead_doubleacute ] };
    key <AC11>  { [    oslash,  Ooblique, dead_circumflex, dead_caron ] };
    key <TLDE>  { [   onehalf,   section, threequarters,    paragraph ] };

    key <BKSL>  { [apostrophe,   asterisk, dead_doubleacute, multiply ] };

    key <LSGT>  { [      less,    greater,    backslash,      notsign ] };

    include "kpdl(comma)"

    include "level3(ralt_switch)"

    key <ESC>  { [ Escape ] };
    key <CAPS> { [ Caps_Lock ] };

};

setxkbmap -print -verbose 10

Setting verbose level to 10
locale is C
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:     vi,da
variant:    ,
Trying to build keymap using the following components:
keycodes:   evdev+aliases(qwerty)
types:      complete
compat:     complete
symbols:    pc+vi+da:2+inet(evdev)
geometry:   pc(pc105)
xkb_keymap {
    xkb_keycodes  { include "evdev+aliases(qwerty)" };
    xkb_types     { include "complete"  };
    xkb_compat    { include "complete"  };
    xkb_symbols   { include "pc+vi+da:2+inet(evdev)"    };
    xkb_geometry  { include "pc(pc105)" };
};
0

Try setting both layouts in the same file using explicit [Group]'s:

key <...> { symbols[Group1] = [ ... ], symbols[Group2] = [ ... ] };

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.