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?
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.
This should be do-able using
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.
Win key in Ubuntu is a modifier. It treated just like the
Ctrl keys and as such cannot be used as a standalone key.