[ You accidentally sent this message to me personally and to debian-powerpc-REQUEST. I put this back on debian-user since I don't follow the powerpc list (and the "-request" address is wrong for normal list mails anyway). ]
On Thu, May 17, 2007 at 09:43:31 +0200, Matthias Brennwald wrote: > Florian Kulzer wrote: >> On Wed, May 16, 2007 at 14:48:53 +0200, Matthias Brennwald (bwm) wrote: >>> Dear all >>> >>> thanks for your replies so far. It looks like I'll have (i) to look >>> harder to find the correct key combination or (ii) tweak the >>> configuration my keyboard setup. I prefer (ii) because I want to use the >>> keys on my keyboard in the way they are labelled (I'm really bad in >>> remembering what keystrokes I'll have to press if it's not obvious from >>> the labels on the keys). [...] > Thanks! In the meantime I realised that the alt key to the right of the > space bar is different from the alt key to the left (that's different from > my previous MacOS-X experience, where both keys behave the same). I can > type the '@' with right-alt-g, but not with left-alt-g. > > What's the reason for this difference? Does it make sense to make left-alt > behave the same as right-alt? I would not make Alt (left) and AltGr (that is how the right one is usually labeled on pc keyboards) the same since you will lose functionality if you do that. Just to give one example: If I use the "." key with AltGr then I get "ยท" (a dot in the middle of the line). The normal Alt, on the other hand, can give the key an additional function (which depends on the application). In the bash shell Alt + "." is a convenient way to insert the last argument from the previous command at the cursor position. This saves a lot of typing and I would certainly not want to miss it. A lot of other X features also depend on a "normal" Alt, e.g. CTRL + ALT + Fn to switch to a tty, CTRL + ALT + BACKSPACE to kill the X server, etc. To make sure that you are not missing anything I would rather swap the two keys than make both act as AltGr. > If not, (how) can I switch their behaviour, > i.e. exchange left-alt with right-alt? (I am used to using left-alt, and > since I'm switching a lot between Debian and MacOS I'd like to keep things > as similar as possible). > > For a start, I need to see the output of: >> xmodmap -pk | grep '(g)\|ISO_Level3_Shift' > > xmodmap -pk | grep '(g)\|ISO_Level3_Shift' > 42 0x0067 (g) 0x0047 (G) 0x0040 (at) 0x002c (comma) 0x0040 > (at) 0x002c (comma) ^^^^^^^^^^^ ^^^^^^^^^^^ All is well: the "macintosh" keyboard definition already has the (at) key symbol at the correct places. (Otherwise we would have put it there.) > 113 0xfe03 (ISO_Level3_Shift) > 124 0xfe03 (ISO_Level3_Shift) [...] I can show you how to swap the functions of the two Alt keys. Let me first clarify a few terms: Every key has a fixed keycode which does not change. Xkb assigns one or more symbols ("keysyms") to each key(code). The keysyms determine what is sent to the active X application when a given key is pressed (and released, but that is a minor detail). The above output of xmodmap tells you that the key with code 42 will produce symbol "g" when pressed alone, symbol "G" when pressed with SHIFT, and, among other things, "@" if pressed with the ISO_Level3_Shift modifier (which is usually AltGr). You can run "xev" and press a few keys to see how this works in practice. In fact, your first step is to find out the keycodes for Alt and AltGr with "xev". On my keyboard Alt has keycode 64 and AltGr has 113. Make sure to also check out the difference between pressing Alt(left) + g and Alt(right) + g. As you probably already guessed, the command to view and change keysyms is "xmodmap". So, let's have a look at the keysyms of Alt and AltGr: $ xmodmap -pke | egrep 'keycode +(64|113)' keycode 64 = Alt_L Meta_L keycode 113 = ISO_Level3_Shift (You can have a look at the entire keymap with "xmodmap -pke | less".) The output of "xmodmap -pke" has the right format to be fed back to xmodmap in order to change keysyms. In principle you only have to exchange "64" and "113" in the two commands above and you will swap the two Alt keys (as far as any X application can tell). There is, however, a small complication: Xkb has an additional keymap for all the modifier keys, which you can display with "xmodmap -pm": $ xmodmap -pm xmodmap: up to 3 keys per modifier, (keycodes in parentheses): shift Shift_L (0x32), Shift_R (0x3e) lock Caps_Lock (0x42) control Control_L (0x25), Control_R (0x6d) mod1 Alt_L (0x40), Alt_L (0x7d), Meta_L (0x9c) mod2 Num_Lock (0x4d) mod3 mod4 Super_L (0x7f), Hyper_L (0x80) mod5 Mode_switch (0x5d), ISO_Level3_Shift (0x71), ISO_Level3_Shift (0x7c) This modifier map contains both keysyms and keycodes, and therefore things will go wrong if you change keysyms of modifier keys on the normal keymap without updating the modifier keymap accordingly. The easiest way to do this is to remove all affected keysyms from the modifier map first, then make your changes to the normal keymap and then add the keysyms to the modifier map again. This is what works for me: remove mod1 = Alt_L Meta_L remove mod5 = ISO_Level3_Shift keycode 113 = Alt_L Meta_L keycode 64 = ISO_Level3_Shift add mod1 = Alt_L Meta_L add mod5 = ISO_Level3_Shift You can put these six line into a plain text file (adapting "64" and "113" if necessary) and then run xmodmap name-of-the-file-with-the-commands to swap Alt and AltGr. This means that you have to use CTRL + ALT(right) for all the special functions, and ALT(left) + g should give you "@". Depending on how you start X it might be enough to put the six commands into a file called ".Xmodmap" in your home directory to have them executed automatically at every start of X. If that does not work then you have to find an "autostart" folder of your desktop environment and put the "xmodmap ~/.Xmodmap" command in a script there. -- Regards, | http://users.icfo.es/Florian.Kulzer Florian |