LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (http://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Mapping AltGr key to act as WIN key (http://www.linuxquestions.org/questions/linux-newbie-8/mapping-altgr-key-to-act-as-win-key-701577/)

krisrao 02-02-2009 02:46 AM

Mapping AltGr key to act as WIN key
 
Hi,
I use ubuntu on a thinkpad X31 with PC102 keyboard with no WIN key. I wish to map the Rt Alt (AltGr) key to act as WIN key (for compiz shortcuts)
How can I do this?
Thanks in advance,
Krishna

ajlewis2 02-02-2009 11:57 AM

First you need to find out what the keycode is for the key you want to map. Bring up a terminal and type in the following, followed by the Enter key:

Code:

xev
Then press on the Right Alt key. In the terminal you will see something like this:

Code:

KeyRelease event, serial 31, synthetic NO, window 0x3800001,
    root 0x5e, subw 0x0, time 9174459, (-616,-31), root:(482,587),
    state 0x8, keycode 113 (keysym 0xffeb, Alt_R), same_screen YES,

The part you need to know is the keycode which here is 113.

The other thing you need to know is Super_L is the name of the left windows key.

Close xev and in the terminal go to your home directory and make a file called .Xmodmap. I doubt that you already have one. Use whatever text editor you know, but don't use a word processor. I show using nano here.:

Code:

cd
nano .Xmodmap

In the file type. Substitute the keycode that you found in xev for the 113:
Code:

keycode 113 = Super_L
After this, log off and back on to incorporate the new addition to your keymapping. After this when you run xev and press the key, you should see Super_L instead of Alt_R.

krisrao 02-02-2009 05:30 PM

Works!
 
Strangely enought the .Xmodmap didn't work with wmii (where I like to use Mod4 as the modifier)
Based on your solution I created a .xsessionrc in my home folder with this line:
xmodmap -e "keycode 108 = Super_L"
This seems to work like a charm.
Thanks for your help

wisonlee 02-11-2009 08:14 PM

no tweak!
 
Quote:

Originally Posted by krisrao (Post 3428822)
Hi,
I use ubuntu on a thinkpad X31 with PC102 keyboard with no WIN key. I wish to map the Rt Alt (AltGr) key to act as WIN key (for compiz shortcuts)
How can I do this?
Thanks in advance,
Krishna

under ubuntu 8.10, system->Preferences->Keyboard->Layouts(tab)->Other Options->Alt/Win key behavior->select "Left Alt is swapped with left win key"

enkoy!!


All times are GMT -5. The time now is 02:29 AM.