3

My Enter key recently broke and I was wondering if I could bind it to a different key in GNOME. Does anyone know how I would go about doing this?

1 Answer 1

4

Yes, you can change the xmodmap. First thing to do is find the keycode for the key you want to use as replacement. To do that, open a terminal, then run xev in the terminal. Move the mouse pointer into the small white window that opens up, then hit the key on the keyboard that you want to use as replacement. In the terminal you should now see a KeyPress event and a KeyRelease event. Make a note of the keycode number it shows, then close the white xev window.

Now, if you don't already have a ~/.Xmodmap file, create one with the current mapping by running

xmodmap -pke > ~/.Xmodmap

Then edit the file with your favorite editor. e.g. gedit ~/.Xmodmap.

Scroll down to the line for the keycode you noted earlier. If the keycode you want to use is 62 for instance, change the line that starts with keycode 62 = to read:

keycode  62 = Return NoSymbol Return

Next time you log in, you'll be asked if you want to load that modmap, so do that, and afterwards that key should work as a return key. For making the change in your current session, load the file with:

xmodmap ~/.Xmodmap

You must log in to answer this question.

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