Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I'm using minimalistic WM controlled by a keyboard..
The main question is, is it possible? How?
For example, Mod6. I know how to remap existing modifiers, but not how to add a new ones. I'm using Arch Linux.

share|improve this question

2 Answers 2

up vote 5 down vote accepted

X normally has 8 modifiers, which have keysyms assigned to them. Pressing a key results in a keyboard event that's associated with the keysym. If the keysym has a modifier assigned to it, then while that key is down, key events will be tagged with that modifier.

The modifiers, together with common keysym assignments, are:

  • Shift: Shift_L, Shift_R
  • Lock: Caps_Lock
  • Control: Control_L, Control_R
  • Mod1: Num_Lock
  • Mod2: Meta_L, Meta_R
  • Mod3: Alt_L, Alt_R
  • Mod4: Hyper_L, Hyper_R
  • Mod5: Super_L, Super_R

The distribution of Alt/Hyper/Meta/Super/NumLock amongst Mod1–5 is arbitrary; you may find them in a different order and you may find that some are missing.

8 modifiers is all you get with the standard X library, and some applications don't even let you get at all of them. Two of these (Shift and Lock) have a fixed meaning that you're unlikely to be able to override without nasty side effects when typing characters.

However, most of the keyboard event processing is handled client-side (i.e. inside each application). So it's possible that a particular application would let you handle more modifiers. The way to do this would be specific to that application (or at least to the library or framework it uses for event processing).

share|improve this answer
4  
8 modifiers is all the X11 core protocol allows due to the 8-bit modifier state field in events. Applications or toolkits supporting more would have to keep track of whether or not the modifier key is pressed themselves instead of relying on the event to tell them (not difficult, just not the normal modifier handling code). –  alanc Jul 17 '11 at 17:04

Usually Mod1-Mod5 are combined with the named Modifiers like Shift, Control, Alt, Hyper, Super.

In some WMs it is possible to dissociate these and use them as ten different modifiers. Not all WM's cooperate with this, but some do.

The important bit is in your .xmodmaprc to clear the various associations using things like clear Mod and clear Shift, but NOT re-combine them using the normal add Mod2 = Alt_L style mappings.

share|improve this answer
    
I don't want to re-combine the existing ones, I want to add one or two modifiers, I need them. I wanted to use 'Menu key' as modifier. How do you mean to 'dissociate ? –  aksr Jul 4 '11 at 9:51
2  
Clearning associations between modifiers and keysyms is likely to break a lot of applications. What are the WMs that you refer to? How does their keyboard handling work? –  Gilles Jul 4 '11 at 9:55

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.