Hi everybody. I'm running into some trouble swapping my Alt_L and Super_L keys on my 2006 Apple MacBook. For starters, I'm running Xubuntu 10.10, and I want to swap the keys because Apple's standard key mapping has the two keys reversed. This is going to be a lengthy post with lots of information, and I apologize for that, but I'm hoping that this information will be helpful.
For starters, running "xmodmap -pk" without having made any prior modifications to .bashrc or .xmodmap shows me the following:
Code:
64 0xffe9 (Alt_L) 0xffe7 (Meta_L) 0xffe9 (Alt_L) 0xffe7 (Meta_L)
133 0xffeb (Super_L) 0x0000 (NoSymbol) 0xffeb (Super_L)
204 0x0000 (NoSymbol) 0xffe9 (Alt_L) 0x0000 (NoSymbol) 0xffe9 (Alt_L)
206 0x0000 (NoSymbol) 0xffeb (Super_L) 0x0000 (NoSymbol) 0xffeb (Super_L)
I've appended the following lines to my ~/.bashrc file:
Code:
xmodmap -e 'keycode 64 = Super_L'
xmodmap -e 'keycode 133 = Alt_L'
After logging out and back in, xev is reporting these keys properly as:
Code:
KeyPress event, serial 34, synthetic NO, window 0x5400001,
root 0xad, subw 0x0, time 5496399, (102,126), root:(655,451),
state 0x8, keycode 64 (keysym 0xffeb, Super_L), same_screen YES,
XLookupString gives 0 bytes:
XFilterEvent returns: False
KeyPress event, serial 34, synthetic NO, window 0x5400001,
root 0xad, subw 0x0, time 5502975, (102,126), root:(655,451),
state 0x0, keycode 133 (keysym 0xffeb, Super_L), same_screen YES,
XKeysymToKeycode returns keycode: 64
XLookupString gives 0 bytes:
XmbLookupString gives 0 bytes:
XFilterEvent returns: False
However, the changes do not seem to be taking effect. So, I also tried creating an ~/.xmodmap file with the following:
Code:
keycode 64 = Super_L
keycode 133 = Alt_L
After this, when I run $ xmodmap -pk in console, I notice that I have the following lines:
Code:
64 0xffeb (Super_L) 0x0000 (NoSymbol) 0xffeb (Super_L)
133 0xffe9 (Alt_L) 0x0000 (NoSymbol) 0xffe9 (Alt_L)
204 0x0000 (NoSymbol) 0xffe9 (Alt_L) 0x0000 (NoSymbol) 0xffe9 (Alt_L)
206 0x0000 (NoSymbol) 0xffeb (Super_L) 0x0000 (NoSymbol) 0xffeb (Super_L)
So I modified ~/.xmodmap to read:
Code:
keycode 64 = Super_L
keycode 133 = Alt_L
keycode 204 = Super_L
keycode 206 = Alt_L
And now xev is reporting key 64 (what I want to be Super_L) as Alt_L and key 133 (which I want to be Alt_L) as Super_L. So I then proceeded to add two lines to my ~/.bashrc file so that it now reads:
Code:
xmodmap -e 'keycode 64 = Super_L'
xmodmap -e 'keycode 133 = Alt_L'
xmodmap -e 'keycode 204 = Super_L'
xmodmap -e 'keycode 206 = Alt_L'
Now when I start up, both xev and xmodmap -pk are reporting exactly the configuration I want, with Alt_L and Super_L swapped (Alt_L = 133 and 206; Super_L = 64 and 204), but these changes are not actually taking effect. I have no idea what gives with that. I have some suspicions about the duplicate entries for these keys when running "xmodmap -pk." Xev only reports the keys as 64 and 133, but xmodmap -pk reports both 64/133 and 204/206. Is it normal for these modifier keys to be listed twice in xmodmap like this?
For what it's worth, the only thing that works is running gnome-keyboard-properties, in which I have my keyboard layout settings adjusted so that Alt_L and Super_L are swapped. While this works perfectly after I open and close it, it's not exactly an optimal solution at all, as I also had to install all kinds of other GNOME applications along with it, including GNOME's appearance and startup management programs, which are interfering with XFCE's own settings. But, after running gnome-keyboard properties, the output of running "xmodmap" in terminal changes from (changes in bold):
Code:
shift Shift_L (0x32), Shift_R (0x3e)
lock Caps_Lock (0x42)
control Control_L (0x25), 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)
to:
Code:
shift Shift_L (0x32), Shift_R (0x3e)
lock Caps_Lock (0x42)
control Control_L (0x25), Control_R (0x69)
mod1 Alt_R (0x6c), Alt_L (0x85), Meta_L (0xcd)
mod2 Num_Lock (0x4d)
mod3
mod4 Super_L (0x40), Super_L (0xce), Hyper_L (0xcf)
mod5 ISO_Level3_Shift (0x5c), Mode_switch (0xcb)
I am thoroughly confused; could somebody perhaps shed some light on what's going on? I will throw it out there that this is the first time I've attempted to use xmodmap to modify my keyboard mapping, and everything above is the result of researching on Google, so perhaps I'm missing a critical step.
Thanks a ton.