3

I added the following to /usr/share/X11/xkb/symbols/us:

key <AC06> {        [         h, H, Left            ]       };
key <AC07> {        [         j, J, Down            ]       };
key <AC08> {        [         k, K, Up              ]       };
key <AC09> {        [         l, L, Right           ]       };
key <AD08> { [ i, I, Home, Home          ] };
key <AB08> { [ comma, less, End, End         ] };
key <CAPS> { [ ISO_Level3_Shift ] }; 

Because arrow keys and Home/End keys are just too goddamn away. The problem is, these modifications get ignored in some programs.

They work well in browers and some text editors like vscode and emacs gui, while they do not in Sublime Text and Konsole (KDE Terminal) for example.

Is there a fix. I'm using Fedora if that matters.

1 Answer 1

1

I just hacked together the following solution. It not only works in Sublime Text, but also allows to select text with shift.

  1. Add preserve[Shift+LevelThree] = Shift; to …/xdb/types/iso9995. Details on askubuntu.
  2. Add type="THREE_LEVEL" and actions[Group1]= [NoAction(), NoAction(), RedirectKey(keycode=<UP>, clearmods=Lock) (for up) to your entries in /usr/share/X11/xkb/symbols/us.

My entries with slightly different keys looks like this:

key <AD07> { type="THREE_LEVEL",
   symbols[Group1]= [ u,            U,         Home,        Home ],
   actions[Group1]= [      NoAction(),      NoAction(),   RedirectKey(keycode=<HOME>, clearmods=Lock) ]
};
key <AD08> { type="THREE_LEVEL",
   symbols[Group1]= [ i,            I,         Up,        Up ],
   actions[Group1]= [      NoAction(),      NoAction(),   RedirectKey(keycode=<UP>, clearmods=Lock) ]
};
key <AD09> { type="THREE_LEVEL",
   symbols[Group1]= [ o,            O,         End,        End ],
   actions[Group1]= [      NoAction(),      NoAction(),   RedirectKey(keycode=<END>, clearmods=Lock) ]
};
key <AC07> { type="THREE_LEVEL",
   symbols[Group1]= [ j,            J,         Left,      Left ],
   actions[Group1]= [      NoAction(),      NoAction(),   RedirectKey(keycode=<LEFT>, clearmods=Lock) ]
};
key <AC08> { type="THREE_LEVEL",
   symbols[Group1]= [ k,            l,         Down,      Down ],
   actions[Group1]= [      NoAction(),      NoAction(),   RedirectKey(keycode=<DOWN>, clearmods=Lock) ]
};
key <AC09> { type="THREE_LEVEL",
   symbols[Group1]= [ l,            L,         Right,      Right ],
   actions[Group1]= [      NoAction(),      NoAction(),   RedirectKey(keycode=<RGHT>, clearmods=Lock) ]
};

Read this article on the Archlinux Wiki for more details.

Maybe you can skip 1. and the type declaration if you don't want to select text with shift.

2
  • Does this still work for you? Everything in Gnome works fine, except of the Sublime
    – Fuxi
    Commented Jun 22, 2021 at 20:17
  • @Fuxi, if it doesn't work in certain apps, they might use the keycode instead of the defined actions. I think, I had this problem once in Atom, but I could change it in the settings. Right now I use github.com/sezanzeb/key-mapper
    – jl005
    Commented Jun 23, 2021 at 15:01

You must log in to answer this question.

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