33

This keyboard has only one super key, so I want to remap the menu key to make up for that.

don_crissti
  • 79,330
  • 30
  • 216
  • 245
MiffTheFox
  • 537
  • 1
  • 7
  • 9

4 Answers4

37

Use xev to find the keycode for the key you want to remap. For example if I press Menu key it tells me that that is keycode 135.

Next in my ~/.xmodmaprc file, I add a line like this:

keycode 135 = Super_R

... to make it the right hand windows key. Then all that remains is to activate the key remaps. This usually happens automatically on login to your x session, but if your Desktop Environment doesn't do that you can run it manually as xmodmap ~/.xmodmaprc from a command line or whatever script gets run when you login.

Caleb
  • 69,278
  • 18
  • 196
  • 226
  • 3
    The only real problem with xmodmap is, when you switch layouts. You have to execute xmodmap again. – greenoldman May 19 '11 at 04:46
  • I just tried exactly this, and I do not get any event for the menu key. I use Xfce4 maybe that's the reason, but I can't map the menu key to anything useful. – Arne Jun 02 '16 at 23:59
  • @arne no event shows in `xev`? Do all the other keys show events? – Caleb Jun 03 '16 at 03:44
  • @Caleb yes all other keys show events. But for me it is solved now. I found out, that when I do `xmodmap ~/.Xmodmap` from `.xinitrc`, as it is described in arch wiki, it does work. Just the preview with xmodmap when I am already logged in doesn't work. – Arne Jun 06 '16 at 18:53
  • Or `$ xmodmap -e "keycode 135 = Meta_L"` for a quick fix. – lukstafi Feb 05 '21 at 06:26
6

I don't know what system you use, but if it is quite modern login as root, go to

/usr/share/X11/xkb/keycodes

Copy (make a backup) evdev file. Edit it. Find the line with Menu Key and change its alias to super key (left or right) e.g. change

alias <MENU> = <COMP>;

to

alias <MENU> = <SUPR>;

Logout, login (X11 has to be restarted), enjoy your new keyboard.

don_crissti
  • 79,330
  • 30
  • 216
  • 245
greenoldman
  • 6,086
  • 16
  • 54
  • 65
3

This does the trick:

xmodmap -e "keysym Menu = Super_R"
Raphael
  • 2,035
  • 1
  • 21
  • 34
-1

for gnome-shell, one just needs to edit this file: /usr/share/X11/xkb/symbols/pc. and then reboot.

象嘉道
  • 538
  • 1
  • 5
  • 8
  • 2
    While this may be a solution to the OPs problem, to make your answer actually helpful you should add an example, and perhaps explaning the details. – Murphy Jan 19 '20 at 10:13