You are not logged in.

#1 2010-09-30 04:53:15

choogi
Member
Registered: 2009-10-06
Posts: 60

[SOLVED] Remapping Alt_R to Super

I'm trying to map my Alt_R (right alt) key to function as Super.  None of the solutions in these links have worked for me:

http://wiki.archlinux.org/index.php/Dwm … ows_Key.29
https://bbs.archlinux.org/viewtopic.php?pid=568967

I've tried adding all of the commands to my .xinitrc and my .Xmodmap.  With any of those commands, after I finish booting X (and executing xmodmap), xev still reports that my right alt key generates an Alt_R.  This is the output of my xmodmap -p:

shift       Shift_L (0x32),  Shift_R (0x3e)
lock        Caps_Lock (0x25)
control     Control_L (0x42),  Control_R (0x69)
mod1        Alt_L (0x40),  Alt_R (0x6c),  Meta_L (0xcd)
mod2        Num_Lock (0x4d)
mod3      
mod4        Super_L (0x85),  Super_R (0x86),  Super_L (0xce),  Hyper_L (0xcf)
mod5        ISO_Level3_Shift (0x5c),  Mode_switch (0xcb)

Anybody else have a clue?

Last edited by choogi (2010-10-01 05:08:28)

Offline

#2 2010-09-30 05:40:18

x33a
Forum Fellow
Registered: 2009-08-15
Posts: 4,587

Re: [SOLVED] Remapping Alt_R to Super

What is the key code for right_alt for your keyboard? If it is different from 113, you do have to Adjust the commands (from the wiki) to reflect your keycode.

Also, only if you are using the .xinit file, will the settings work. i.e., if you are using a login graphical manager like gdm, kdm, or slim, then it won't work (unless you use a custom xsession).

Offline

#3 2010-09-30 12:27:05

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: [SOLVED] Remapping Alt_R to Super

Run xev (from xorg-utils package) to get the keycodes.

Offline

#4 2010-09-30 15:12:43

milomouse
Member
Registered: 2009-03-24
Posts: 940
Website

Re: [SOLVED] Remapping Alt_R to Super

I had wanted to do the same thing and, as others have suggested, I used xev to get the values. Here's what I do to swap Alt_L with Super_L and swap Alt_R with Super_R (your keycodes may vary):

xmodmap -e "keycode 133 = Alt_L"
xmodmap -e "keycode 135 = Alt_R"
xmodmap -e "keycode 64 = Super_L"
xmodmap -e "keycode 108 = Super_R"
xmodmap -e "clear Mod1"
xmodmap -e "clear Mod4"
xmodmap -e "add Mod1 = Alt_L Alt_R"
xmodmap -e "add Mod4 = Super_L Super_R"

This is near the beginning of my .xinitrc file and has worked fine for me (after failed attempts using other variables/options).

Offline

#5 2010-10-01 04:54:16

choogi
Member
Registered: 2009-10-06
Posts: 60

Re: [SOLVED] Remapping Alt_R to Super

Awesome, thanks for that.  I actually just solved this problem by adding this into my .xmodmap file:

remove mod1 = Alt_R
keysym Alt_R = Super_L

This maps Alt_R to Super_L like the solution from the archwiki page but it doesn't depend on the keycode for Alt_R, which makes this solution more general/robust.  Maybe I should update the archwiki page with this solutions instead unless someone has a reason why this might break.

Also of note, I found out tonight that setxkbmap resets any keycode changes made in xmodmap.  (see https://bbs.archlinux.org/viewtopic.php?pid=709991) This tripped me up for a while because I was running it after xmodmap in my .xinitrc and setxkbmap was killing my key remaps.  Hope this helps someone else!

Last edited by choogi (2010-10-01 04:55:42)

Offline

Board footer

Powered by FluxBB