An XKB keyboard map that responds to the left and right shift key individually

Posted by mbfisher on Super User See other posts from Super User or by mbfisher
Published on 2012-10-03T08:11:10Z Indexed on 2012/10/23 5:12 UTC
Read the original article Hit count: 517

Filed under:
|

First off, excuse my ignorance of X and XKB; I've been trying to hack together a solution in the hope of being able to achieve what I want without requiring a detailed grasp of it.

I'm trying to create an XKB keyboard map on Ubuntu 12.04 that allows me to stipulate which of the two shift keys constitutes the Level2 modifier. Specifically, the 4 key should only produce a $ when the right shift is held, not the left.

My reading so far:

I've attempted to define a custom type, and then refer to it explicitly in a symbols map:

/usr/share/X11/xkb/types/mbfisher:

default xkb_types "mbfisher" {
  type "RIGHT_SHIFT" {
    modifiers = None+Shift_R;
    map[None] = Level1;
    map[Shift_R] = Level2;
  };
}

/usr/share/X11/xkb/symbols/mbfisher:

default
partial alphanumeric_keys
xkb_symbols "basic" {

  name[Group1]= "mbfisher";

  key <AE04> {
    type= "RIGHT_SHIFT",
    symbols[Group1]= [ 4,  dollar ]
  };

};

I'm then selecting the map with the Ubuntu Keyboard Layout GUI.

This obviously disables the alphanumeric keyboard apart from the 4 key, but the dollar sign can still be typed with either shift key.

I'm conscious of writing a massive question with lots of useless information so I'll stop here; please ask for anything I've missed out.

Any ideas?

© Super User or respective owner

Related posts about linux

Related posts about keyboard