I want I J K L to function as arrow keys when CapsLock is pressed down. To do this, I pasted the following to the bottom of the /usr/shar/X11/xkb/symbols/pc
file:
partial partial alphanumeric_keys
xkb_symbols "alpha_arrows" {
key <AC07> { symbols[Group2]=[ Left, Left, Left, Left ] };
key <AC08> { symbols[Group2]=[ Down, Down, Down, Down ] };
key <AC09> { symbols[Group2]=[ Right, Right, Right, Right ] };
key <AD08> { symbols[Group2]=[ Up, Up, Up, Up ] };
};
I then added the following command to my .bashrc
file:
setxkbmap -option grp:caps_switch
This indeed disables CapsLock and allows Alt-CapsLock to toggle the caps lock command. My understanding is that holding CapsLock down should activate the "Group2" key bindings that I set up above... But this simply doesn't happen.
I've tried clearing the cache using rm -rf /var/lib/xkb/*
and the restarting the machine several times. Still no dice. Notably, I was able to swap Left-Control and Left-Super, so I know that xkb/symbols/pc
is the right file to edit.
Questions:
Is there a way to check/confirm that "Group2" is activated? As you may be able to tell, I only have a tenuous grasp on how this works.
Is it valid to just paste that block of code at the bottom of the
xkb/symbols/pc
file?Is there an equally easy alternative to remap these keys? I'd also be interested in remapping Home, End, etc...
References that have got me this far:
- http://domwatson.codes/2014/11/who-needs-capslock-anyway-part-2.html
- https://unix.stackexchange.com/questions/153841/how-to-make-altgri-j-k-l-work-properly-as-cursor-keys
Note: This question seems to be have been asked in various forms around the internet, and I was hesitant to add more noise to the system. But a lot of what I've read has used xmodmap
which is now (apparently) outdated. And AutoKey made me want to stab my eyes out.