I'm trying to improve my keyboard layout using xkb and it worked great using the default 4 levels (or should I say 2 levels? I don't really know the terms..

And when I'm at opening a parenthesis, I found xkb very poorly documented (or I don't know how to search).. Some speak of levels, some of groups, some define levels as shift being the first, AltGr the second and others consider the base character being the first then increamenting each combination. I mean there are many inconsistencies..)

Anyway, here is the default 4 "combinations" with the key M in some keyboards:

// Pressing   <M> <Shift+M> <AltGr+M> <Shift+AltGr+M>
key <AB07> { [ m ,    M    ,    mu   ,      mu       ] }; // m M µ µ

Is it possible to add into the mix others modifiers?

For example with one extra modifier for example the R Ctrl I can have 6 combinations:

// Pressing   <M> <Shift+M> <AltGr+M> <AltGr+Shift+M> <RCtrl+M> <RCtrl+Shift+M>
key <AB07> { [ m ,    M    ,    mu   ,    mu         , comma  , semicolon] };// m M µ µ , ;

Or even 8 combinations with all the three modifiers..
And in fact it seems that there is already an 8 level mapping in some symbol files with the keyword EIGHT_LEVEL

However I'm not looking to get 42 combinations for one key..

Rather I just want to avoid awkward combination for my fingers and for that I prefer to still have only limited combinations with "direct access", like so:

// Pressing   <M> <Shift+M> <AltGr+M>  <RCtrl+M>  <RWin>+M
key <AB07> { [ m ,    M    ,  comma  , semicolon ,    µ   ] }; // m M , ; µ

I would also want to map other characters or even moves (arrows, home/end, page up/down) with other unused modifiers (capslock, numlock)

How can I do this ?

Thank you very much.

  • 8-level mappings use 2 level-shifting keys: ISO_Level3_Shift and ISO_Level5_Shift. various combinations with of these with Shift (aka level2-shift) give you access to all 8 symbols in the mapping. see the various lv5: options in man xkeyboard-config. you may also be interested in this question and the solution presented: unix.stackexchange.com/questions/302163/…
    – quixotic
    Jun 6, 2018 at 12:27
  • Thanks.. Do you know if it is possible to increase the levels? I mean I only intersted to combination that don't chord a lot (ie. two kestrokes - the nth level modifier + the key)?
    – SanjiBukai
    Jun 11, 2018 at 2:52
  • if you're asking how to add shift-keys for levels 4, 6, 7, and 8, the previous link touches on those. (the answer demonstrates latch rather than shift, but a shift implementation would be similar.) ... if you're asking about a level9 and higher, see this answer: unix.stackexchange.com/a/411887/222377
    – quixotic
    Jun 14, 2018 at 20:47
  • Thanks. So if I wanted to have only the <levelX>+key combinations (without chording), I should define the level 3, level 5, level 9, level 17, level 33 and so on (level 2ⁿ+1)? Is this even possible? If so (it'll weird though) I probably should put NoSymbol to all unwanted chording combinations?
    – SanjiBukai
    Jun 15, 2018 at 10:23
  • as pointed out in the second link, level9 is not a current possibility without rewriting some code. if you want shift/lock/latch keys for level4, level6, level7, and level8 (so you can reach those levels with one shift/lock/latch instead of 2-3, which i assume is what "without chording" is trying to achieve), the first link is what you want.
    – quixotic
    Jun 15, 2018 at 20:46

1 Answer 1


There you can use group to achieve the "two keystrokes" objective :

key <AB07> { 
type[group1]= "FOUR_LEVEL",
type[group2]= "TWO_LEVEL_BIS",
symbols[group1]= [ m ,    M    ,  comma  , NoSymbol],
symbols[group2]= [ semicolon ,    µ ] 

Now you must define the type TWO_LEVEL_BIS for using your desired modifiers.

It is worth to know than Mode_switch is a key that increment the actual group, so have a look to it's definition.

You must log in to answer this question.

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