2

I created a custom keyboard layout in xkb format to simulate arrow keys and put it in /usr/share/X11/xkb/symbols/custom:

xkb_symbols { name[Group1]= "English (US) with Caps mod"; key <ESC> { [ Escape, asciitilde, grave ] }; key <INS> { [ Insert, Insert, Caps_Lock ] }; key <TAB> { [ Tab, ISO_Left_Tab, Menu ] }; key <AC06> { [ h, H, Left ] }; key <AC07> { [ j, J, Down ] }; key <AC08> { [ k, K, Up ] }; key <AC09> { [ l, L, Right ] }; }; 

After activating it with: setxkbmap -layout custom -option lv3:caps_switch it works as expected, except for on annoyance: Although I can use Caps+{H,J,K,L} to navigate via the simulated arrow keys, it is not possible to combine it with other modifiers.
For example, the combinations Super+Caps+{H,J,K,L} or Ctrl+Shift+Caps+{H,J,K,L}) just don't work and I have to use the regular arrow keys for those.

Is there a way to get this working or is this a limitation of xkb?

1 Answer 1

0

I wasn't able two get it working with the lv3:caps_switch option. Only after defining a separate two level modifier for caps, the simulated arrow keys worked together with other modifiers such as SUPER.

I have used the de layout as base, but it should work with others as well. Here is my new /usr/share/X11/xkb/symbols/custom file (setxkbmap -layout custom -variant 5layer to activate):

default partial alphanumeric_keys xkb_symbols "5layer" { include "de(basic)" include "ansi_hybrid(caps_layer)" include "ansi_hybrid(ralt_layers)" }; partial modifier_keys xkb_symbols "caps_layer" { // caps layer key definitions replace key <CAPS> { type[Group1] = "TWO_LEVEL", symbols[Group1] = [ Overlay1_Enable, Overlay1_Enable ], actions[Group1] = [ SetControls(controls=Overlay1), SetControls(controls=Overlay1) ] }; key <LatH> { Overlay1 = <LEFT> }; key <LatJ> { Overlay1 = <DOWN> }; key <LatK> { Overlay1 = <UP> }; key <LatL> { Overlay1 = <RGHT> }; }; partial modifier_keys xkb_symbols "ralt_layers" { // base, shift, ralt, shift+ralt layers key definitions key <CODE> { [ base, shift, ralt_base, ralt_shift_symbol ] }; }; 

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.