I use a layout which is not QWERTY for first and second level.

    key <AC06> {
        type= "FOUR_LEVEL_ALPHABETIC",
        symbols[Group1]= [               m,               M,        Left,        Home ]
    key <AB01> {
        type= "ALPHABETIC",
        symbols[Group1]= [               x,               X ]

I would like any key combination which has Ctrl in it (left Ctrl, or left and right ctrl) to change the layout back to QWERTY for the keypress.

So if I type Ctrl+<AB01> I would like to get Ctrl+z, and if I type ctrl+shift+<AB01> I would like Ctrl+shift+z. Ctrl+<AC06> = Ctrl+h, etc

Is something like this possible with xkb?

  • It's possible. How many non-qwerty levels do you need? Sep 20, 2020 at 7:30

1 Answer 1


There are two important folders:

  • /usr/share/X11/xkb/symbols is where your non-Qwerty layout is located on most distros.
  • /usr/share/X11/xkb/types is for modifiers (like Ctrl or Shift) behavior.

It has 4 official levels, compatible with Ctrl, Shift and Lock (aka CapsLock).
I added this code in /usr/share/X11/xkb/types/level5 :

    modifiers = Shift+Control+Lock;
    map[None] = Level1;
    map[Shift] = Level2;
    map[Control] = Level3;
    map[Shift+Control] = Level4;
    preserve[Control] = Control;
    preserve[Shift+Control] = Control;
    map[Lock] = Level2;
    map[Lock+Shift] = Level1;
    map[Lock+Control] = Level4;
    map[Lock+Shift+Control] = Level3;
    preserve[Lock+Control] = Control;
    preserve[Lock+Shift+Control] = Shift+Control;
    level_name[Level1] = "Base";
    level_name[Level2] = "Shift";
    level_name[Level3] = "Alt Base";
    level_name[Level4] = "Shift Alt";

I added it on line 2, after partial default xkb_types "default" {.
And now you should use the type name QWERTY_CONTROL instead of FOUR_LEVEL_ALPHABETIC.

Here is the code for keyboard layout. I added mine on /usr/share/X11/xkb/symbols/oo:

partial alphanumeric_keys
xkb_symbols "half_qwerty" {
    augment "level5"
        name[Group1]="french ergodox compat";

    key.type[Group1] = "QWERTY_CONTROL";

    key <LatA> {[egrave, Egrave, a,A]};
    key <LatS> {[eacute, Eacute, s,S]};
    key <LatD> {[p, P, d,D]};
    key <LatF> {[apostrophe, degree, f,F]};


Then run setxkbmap oo -variant half_qwerty to try it.
You should get è (egrave), é (eacute), p and ' on the middle row.
If you use them with Ctrl, it's still a, s, d and f.

Note: I tested it on several softwares

  • It works on: MPV, Dolphin, Gedit, LibreOffice, Firefox, ST+ZSH, ST+NeoVim and Rofi.
  • It doesn't work well on Chromium.

You must log in to answer this question.

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