Ubuntu – How to use Caps Lock as Enter in 14.04

14.04keyboard-layoutremapping

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?

Best Answer

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)