3

After extensive search, I've only found guides to remap/swap Caps Lock to something like Control. However, I am trying to make Caps Lock another Enter (to be precise, I want it for one-handed 'Run' in Rstudio).

It seems that the XKB-options only allow very specific commands that can be found by:

man 7 xkeyboard-config

These options are also the ones that most tweak tools allow. Is there any more powerful option, that allows remapping Caps Lock to an arbitrary key, in particular Enter, or should I give up my search?

1 Answer 1

4

First You can search for replacements keycodes in your case via following command in terminal:

$ xmodmap -pke | grep Caps
keycode  66 = Caps_Lock NoSymbol Caps_Lock

$ xmodmap -pke | grep Enter
keycode 104 = KP_Enter NoSymbol KP_Enter

You can get all keycodes according to keys by command xmodmap -pke.

So, Run following command (to get Caps-Lock Work as Enter Key):

xmodmap -e "keycode 66 = KP_Enter"

(Then you can set/assign suitable key to keycode by command xmodmap -e)

4
  • You can also use Tweak toll.
    – Pandya
    Sep 16, 2014 at 14:03
  • Thanks so much! However, the Caps Lock function still worked, which means my case changed each time I used it as Enter. Disabling Caps Lock in (Gnome) Tweak Tool, then running your command worked, however, so that's great. Also, I assume this resets when I reboot? Maybe I could add this command to startup? Sep 16, 2014 at 15:12
  • Yes it is reset after reboot and you can add this command to startup.
    – Pandya
    Sep 17, 2014 at 13:55
  • @KeesMulder To remove caps lock functionality delete the associated line under modifier mappings, e.g. modifier_map Lock { Caps_Lock }; in /usr/share/X11/xkb/symbols/pc where the key mappings are stored.
    – marzano
    Oct 8, 2019 at 3:00

You must log in to answer this question.

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