I have a keyboard with two "Win" keys but without "Menu" key. I'd like to bind my right Win as Menu. I tried do used xev in terminal and get keycode for .Xmodmap file but can't take code of right Win. Just always open system menu of ubuntu. How I can do it?
-
I've answered a similar question here https://askubuntu.com/a/1323635/935982 that might be helpful – Harsh Gundecha Mar 18 '21 at 04:50
3 Answers
This should be do-able using xmodmap
.
First, find the keycode for your Win-key: Enter terminal using Ctrl+Alt+T
, and type xev
. Now press your Win-key and note down the keycode shown.
(If you have problems obtaining the keycode, you may first have to change the Win-key from being a one-key shortcut for Dash. How this can be done has been answered here.
Once you obtain the keycode, say xxx
, execute in terminal
xmodmap -e "keycode xxx = Menu"
This should map you Win-key to Menu. You can test it using e.g. xev
again: a little after the keycode, it should now write something like (keysym 0xff67, Menu)
.
To automate setting it on startup, see e.g. this.
If you haven't tried the keyboard preference mapping under Gnome, you should give it a look. This doesn't fit your description exactly, but it might work well enough.
From type, type keyboard to go to the keyboard preferences. Select the Layouts tab, then choose Win/Alt behavior.

- 23,120
The Win
key in Ubuntu is a modifier. It treated just like the Alt
and Ctrl
keys and as such cannot be used as a standalone key.

- 609
-
2It is used as a "standalone" key in both 11.04 and 11.10. It does open the "main menu", which is dash in Unity, but it's also used in combination with other keys. Your answer is wrong. -1 – Jo-Erlend Schinstad Sep 11 '11 at 13:40