4

In the xkb guide on archlinux: https://wiki.archlinux.org/index.php/X_keyboard_extension we see this configuration to set up LWIN as an ISO_Level3_Shift

   xkb_symbols { 
       key <LWIN> { [ISO_Level3_Shift ] };
       modifier_map Mod5 { ISO_Level3_Shift };
   }
   xkb_compatibility {
       interpret ISO_Level3_Shift { action= SetMods(modifiers=Mod5); };
   }

Now I am a bit confused.

  • ISO_Level3_Shift is a virtual modifier. So we need to map it to a real modifier somehow. But what is the difference between modifier_map Mod5 { ISO_Level3_Shift }; and interpret ISO_Level3_Shift { action= SetMods(modifiers=Mod5); };? Why do we need both?

  • In the xkb file compat/level5 I see things like

      interpret ISO_Level5_Shift+Any {
      useModMapMods= level1;
      virtualModifier= LevelFive;
      action= SetMods(modifiers=LevelFive);
      };
    
      interpret ISO_Level5_Shift {
      action= SetMods(modifiers=LevelFive);
      };
    

    What does useModMapMods and virtualModifier mean here?

1 Answer 1

1

Disclaimer: I'm still trying to understand XKB and might be wrong. But since there is no other answers so far, here is my current understanding.

Regarding the first part of the question about ISO_Level3_Shift: modifier_map is needed for backward compatibility with the old core protocol. For example, it's needed for the old xmodmap program to work somewhat correctly. And xmodmap might be still widely used because people have ~/.Xmodmap files that are easy to use and easy to understand compared to XKB. But the modern way is to use interpret ... approach.

The second part of the question regarding level5, useModMapMods and virtualModifier is harder for me. Probably I don't understand XKB enough to give a simple answer. I better quote the documentation: useModMapMods= level1; means LevelOneOnly. From https://www.x.org/releases/current/doc/kbproto/xkbproto.pdf page 54:

The levelOneOnly setting, indicates that the interpretation in question should only use the modifiers bound to this key by the modifier mapping if the symbol that matches in level one of its group. Otherwise, if the symbol being considered is not in shift level one of its group, the server behaves as if the modifier map for the key were empty. Note that it is still possible for such an interpretation to apply to a symbol in a shift level other than one if it matches a key without modifiers; the levelOneOnly flag only controls the way that matches are determined and that the key modifiers are applied when an interpretation does match.

As far as I understand the virtualModifier= LevelFive line is again for backward compatibility. It's possible to specify the mapping in either interpret section or directly in the key definition.

While I seem to understand each of the above statements independently I still can't come up with an example that would illustrate usage of these ISO_Level5_Shift and ISO_Level5_Shift+Any interpretations.

You must log in to answer this question.

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