I've remapped CapsLock key to work like this :

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

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.

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

  • 1
    Please post your xmodmap changes.
    – harrymc
    Oct 7, 2013 at 7:27
  • I am not a linux person but, probably xmodmap cannot detect CapsLock+J key sequence because you have held the Shift key down. And I think it wont be just shift. Test any key on keyboard say ctrl, alt, pgdn etc.. Oct 10, 2013 at 7:37

5 Answers 5


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 ] };
  • Thanks for the answer, looks like it may be correct. I cannot accept it, though. I don't have any Ubuntu machine right now to try it out.
    – varad
    Jul 29, 2018 at 23:29

Your problem may be that capslock and shift are nearly the same in your keyboard hardware, it may be that your capslock key just permanently triggers the shift key.

  • 1
    You could probably check this by pressing Shift + J/ Shift + K, and seeing if they trigger your remapped keys Caps Lock key functions.
    – Jaymz
    May 17, 2011 at 8:11
  • Shift + J / Shift + K is not affected by my remapping.
    – varad
    May 24, 2011 at 8:54

If I have understood well how it works, try in the keyboard specification file to explicit say what you want for example for he shifted ation, for example

key { [ j, J, Down, Next ] };
key { [ k, K, Up, Prior ] }; 

to have PageDn and PageUp --- I cannot chek it now, but should work.


I've tested many suggested methods but I've found this by far simplest to implement and understand. Create file nano ~/.my_keyboard, paste the code below (change key mapping according to you plan) and run xmodmap ~/.my_keyboard.

clear lock
keycode 66 = Mode_switch

keysym h = h H Left Left hstroke Hstroke
keysym j = j J Down Down dead_hook dead_horn
keysym k = k K Up Up lstroke ampersand
keysym l = l L Right Right lstroke Lstroke

This disables standard Caps Lock functionality and remaps key to Mode_switch modifier. To reset xmodmap settings you can run setxkbmap.

Here is the original solution I've addapted.

  • You’ve tested … against what requirements?  This answer doesn’t look like it’s even trying to answer this question.  The OP wants J = Left; you're mapping J to Down.  The OP wants K = Down; you're mapping K to Up.  The OP wants Caps Lock to combine with J and K, and you're disabling it?  How is this even close to being an answer to this question? Sep 10, 2017 at 4:44
  • OP wanted to have additional arrow keys accessible using Caps Lock + some-keys. He specifically wanted this remapping to work with Shift key so that it behvaes like with regular arrow keys (selecting using Shift + arrow keys). Link of the partial solution he provided disables normal functionality of Caps Lock as well, and since OP didn't mention that as a problem I assumed that is OK. Mapping specific keys to arrows is trivial to change, but it is my mistake here... I wanted to do exactly the same thing so I think I have idea what OP had in mind.
    – izumitelj
    Sep 11, 2017 at 8:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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