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?

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 '14 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 '14 at 15:12
  • Yes it is reset after reboot and you can add this command to startup.
    – Pandya
    Sep 17 '14 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 '19 at 3:00

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.