I've remapped CapsLock key to work like this :

CapsLock + J = Left arrow key
CapsLock + K = Down arrow key
etc.

I've used xmodmap (as explained in Mapping Super+hjkl to arrow keys under X).

The problem is that I can't seem to be able to make following key combinations work :

Expected: CapsLock + Shift + J = Shift + Left arrow key
Actual: CapsLock + Shift + J = does nothing.
etc.

Do you have any ideas how to make it work? Thanks.


Not a direct answer, but the best way to approach this would be to see what events are being fired when you press the combinations you're interested in. To do this, install xev and try out the various combinations.


I was having the same problem and asked it over on AskUbuntu. The issue can be solved by:

setting the preserve parameter

edit /usr/share/X11/xkb/types/iso9995 and add preserve[Shift+LevelThree] = Shift; such that the contents of the file looks like:

  partial default xkb_types "default" {

// A key type which can be used to implement
// an ISO9995-style level-three shift.

virtual_modifiers LevelThree;

type "THREE_LEVEL" {
    modifiers = Shift+LevelThree;
    map[None] = Level1;
    map[Shift] = Level2;
    map[LevelThree] = Level3;
    map[Shift+LevelThree] = Level3;
    preserve[Shift+LevelThree] = Shift;
    level_name[Level1] = "Base";
    level_name[Level2] = "Shift";
    level_name[Level3] = "Level3";
    };
};

customize the symbols file for the desired layout

Edit the keyboard layout file in /usr/share/X11/xkb/symbols/ as following (adapting to your own needs)

key <AC06>  { type="THREE_LEVEL", [   h,   H, Left  ]   }; 
key <AC07>  { type="THREE_LEVEL", [   j,   J, Down  ]   }; 
key <AC08>  { type="THREE_LEVEL", [   k,   K, Up    ]   }; 
key <AC09>  { type="THREE_LEVEL", [   l,   L, Right ]   }; 

and not like

 ....
 key { [ j, J, Down, Down ] };
 ....