This is an old question, but since there were no proper answers and I was interested in this problem for my own reasons, I took the time to work this out. Configuring XKB can be tricky, but this can certainly be done.
For the first question, you can generate a picture with all the names of the keys on your currently configured keyboard with this magical command:
setxkbmap -print | xkbcomp - - | xkbprint -color -label name - - | ps2pdf - > keynames.pdf
and view the pdf file keynames.pdf
For the second question, we have to dive deep into XKB configuration. I believe the best source of information is the developers' documentation. The short story is that we need to map keys to combinations of "real modifiers" and we need to map these combinations to levels for the keys.
In the symbols file, we would like to write e. g.
key <AC01> { [ a, A, b, B, c, C, d, D, e, E, f, F, g, G, h, i, j, k, l, m, n, o, p, q, r, s, t, u]};
which means that on the button for A, we have the symbol a on the first level, A on the second, b on the third, and so on, and then map keys to the various levels. As this example suggests, however, it would likely make sense to have every other level correspond to pressing a modifier key + a shift key for some modifier keys, and for some keys the same symbol will be produced regardless of whether shift is pressed. This is what we shall accomplish.
XKB uses "real" and "virtual" modifiers to keep track of modifier levels. The virtual ones can have any name, and we can have 16 of those. Each key will however need to correspond to a combination of the "real" modifiers, and since we will be using a large number of keys, we may as well use the real modifiers right away.
What complicates things is that there is a fixed list of "real modifiers", namely the eight Shift, Lock, Control and Mod1 to Mod5. Any combination of these can however also be used, so theoretically 2⁸ = 256 different levels for each key. In practice, however, some of these are already in use in various ways in the OS and in programs, so we shall have to be a little careful when selecting these. There is also a limit in XKB on 63 or 64 levels of symbols for each key, though one can use groups to multiply this number by four. We shall not use groups here.
The modifiers Control and Mod1 = Alt are commonly used by the OS and programs, so we shall not use these. Mod4 = Super is also used, but we can use it together with other modifiers. We first create a type file that will map combinations of modifiers to levels. Write the following in a file called multimod_type and place it in /usr/share/X11/xkb/types.
default partial xkb_types "multimod_type" { // We use real modifiers Shift, Mod2, Mod3, Mod4, Mod5. // Mod1 = Alt, so we do not use this. // In addition, Mod4 = Super is used by the OS, which causes // problems in four places. type "MULTIMOD" { modifiers = Shift + Mod2 + Mod3 + Mod4 + Mod5; map[None] = 1; map[Shift] = 2; map[Mod2] = 3; map[Mod2 + Shift] = 4; map[Mod3] = 5; map[Mod3 + Shift] = 6; map[Mod3 + Mod2] = 7; map[Mod3 + Mod2 + Shift] = 8; map[Mod4 + Mod3] = 9; map[Mod4 + Mod3 + Shift] = 10; map[Mod4 + Mod3 + Mod2] = 11; map[Mod4 + Mod3 + Mod2 + Shift] = 12; map[Mod5] = 13; map[Mod5 + Shift] = 14; map[Mod5 + Mod2] = 15; map[Mod5 + Mod2 + Shift] = 16; map[Mod5 + Mod3] = 17; map[Mod5 + Mod3 + Shift] = 18; map[Mod5 + Mod3 + Mod2] = 19; map[Mod5 + Mod3 + Mod2 + Shift] = 20; map[Mod5 + Mod4 + Mod3] = 21; map[Mod5 + Mod4 + Mod3 + Shift] = 22; map[Mod5 + Mod4 + Mod3 + Mod2] = 23; map[Mod5 + Mod4 + Mod3 + Mod2 + Shift] = 24; // Mod4 = Super is used map[Mod4 + Shift] = 25; // Mod4 + Mod2 is used map[Mod4 + Mod2 + Shift] = 26; // Mod5 + Mod4 is used map[Mod5 + Mod4 + Shift] = 27; // Mod5 + Mod4 + Mod2 is used map[Mod5 + Mod4 + Mod2 + Shift] = 28; // Level names are only for description. The values are not used. level_name[1] = "Base"; level_name[2] = "Shift"; level_name[3] = "Alt1"; level_name[4] = "Alt1 + Shift"; level_name[5] = "Alt2"; level_name[6] = "Alt2 + Shift"; level_name[7] = "Alt3"; level_name[8] = "Alt3 + Shift"; level_name[9] = "Alt4"; level_name[10] = "Alt4 + Shift"; level_name[11] = "Alt5"; level_name[12] = "Alt5 + Shift"; level_name[13] = "Alt6"; level_name[14] = "Alt6 + Shift"; level_name[15] = "Alt7"; level_name[16] = "Alt8"; level_name[17] = "Alt9"; level_name[18] = "Alt10"; level_name[19] = "Alt11"; level_name[20] = "Alt12"; level_name[21] = "Alt13"; level_name[22] = "Alt14"; level_name[23] = "Alt15"; level_name[24] = "Alt16"; level_name[25] = "Alt17"; level_name[26] = "Alt18"; level_name[27] = "Alt19"; level_name[28] = "Alt20"; }; };
As the names suggests, we will have 20 extra modifier buttons, and the first six of these can be used in combination with shift.
To use this, modify this minimal working example of a symbols file. I call this multimod_se. Save it in /usr/share/X11/xkb/symbols as usual.
default partial alphanumeric_keys xkb_symbols "multimod_se" { // Include your favourite symbols include "se" name[Group1]="Swedish with many modifiers on A"; key.type[Group1] = "MULTIMOD"; key <AC01> { [ a, A, b, B, c, C, d, D, e, E, f, F, g, G, h, i, j, k, l, m, n, o, p, q, r, s, t, u]}; // ----- Modifiers ----- key.type = "ONE_LEVEL"; key.repeats = False; // We will map F1-F10 and 1-9 and 0 to the modifier keys // The keys F1-F6 produce different symbols with shift pressed key <FK01> { [ Hyper_R ], actions = [SetMods(modifiers=Mod2)]}; key <FK02> { [ Hyper_R ], actions = [SetMods(modifiers=Mod3)]}; key <FK03> { [ Hyper_R ], actions = [SetMods(modifiers=Mod2+Mod3)]}; key <FK04> { [ Hyper_R ], actions = [SetMods(modifiers=Mod3+Mod4)]}; key <FK05> { [ Hyper_R ], actions = [SetMods(modifiers=Mod2+Mod3+Mod4)]}; key <FK06> { [ Hyper_R ], actions = [SetMods(modifiers=Mod5)]}; // We can bind buttons to include shift in order to get a // shortcut to a modifier button + shift key <FK07> { [ Hyper_R ], actions = [SetMods(modifiers=Mod2+Mod5)]}; key <FK08> { [ Hyper_R ], actions = [SetMods(modifiers=Mod2+Mod5+Shift)]}; key <FK09> { [ Hyper_R ], actions = [SetMods(modifiers=Mod3+Mod5)]}; key <FK10> { [ Hyper_R ], actions = [SetMods(modifiers=Mod3+Mod5+Shift)]}; key <AE01> { [ Hyper_R ], actions = [SetMods(modifiers=Mod2+Mod3+Mod5)]}; key <AE02> { [ Hyper_R ], actions = [SetMods(modifiers=Mod2+Mod3+Mod5+Shift)]}; key <AE03> { [ Hyper_R ], actions = [SetMods(modifiers=Mod3+Mod4+Mod5)]}; key <AE04> { [ Hyper_R ], actions = [SetMods(modifiers=Mod3+Mod4+Mod5+Shift)]}; key <AE05> { [ Hyper_R ], actions = [SetMods(modifiers=Mod2+Mod3+Mod4+Mod5)]}; key <AE06> { [ Hyper_R ], actions = [SetMods(modifiers=Mod2+Mod3+Mod4+Mod5+Shift)]}; // The following four must be defined with shift key <AE07> { [ Hyper_R ], actions = [SetMods(modifiers=Mod4+Shift)]}; key <AE08> { [ Hyper_R ], actions = [SetMods(modifiers=Mod2+Mod4+Shift)]}; key <AE09> { [ Hyper_R ], actions = [SetMods(modifiers=Mod4+Mod5+Shift)]}; key <AE10> { [ Hyper_R ], actions = [SetMods(modifiers=Mod2+Mod4+Mod5+Shift)]}; };
This creates a keymap where F1 to F10 and 1 to 9 as well as 0 are extra modifier keys. Pressing these together with the button A will print the letters a-u, and together with shift we also get A-G. Load the symbols together with the type file with the command
setxkbmap -types complete+multimod_type multimod_se
We include the standard type file complete since we use the type ONE_LEVEL for the modifier keys, and some other types in the included symbols file.
Some comments: The standard way to treat modifiers is with rules in a compat file, but this requires a unique symbol, which does not do anything else, for each modifier key. We can come around this by defining the modifier rule directly in the symbols file, as above. As you can see all modifier keys give the symbol Hyper_R.
If you need more modifier keys, you can also include combinations with Mod1, Control and Lock that are not used by the OS or programs to represent something else.