How do I get Right-Alt key to be just Alt and not generate special characters? (KDE)
I note that there is a posting on Success Stories about how to generate characters with diacriticals, such as this "e-acute" (é). On my Mandrake (10.0-official) system, I've always been able to use Right-Alt-semicolon, "e" to get the e-acute, for example. My problem is the opposite.
I want the Right-Alt to behave NORMALLY. I want to be able to hit Alt-Enter (for example) without reaching all the way to the other Alt key on the left. I'm used to using either Alt key and I don't want some new meaning assigned to the one on the right. I don't want special characters (and when I do, I want access to the 20000 Chinese characters, hardly something that a Right-Alt key can cope with).
How do I change this? I've tried the KDE Control Centre (Accessibility > Keyboard Layout > xkb options > Compose Key > turn off R-Alt Is Compose Key), the Mandrake Control Centre, and have even tried diddling with the XFree86 config file. I'm sure that last one is the key to the whole thing, but I haven't yet been able to figure out exactly what to do. All I want is an Alt key that's an Alt key. Can anyone point the way?
I figured it out! How to set X keyboard options
Okay, it turns out that Mandrake had been driving me nuts for all this time and I was able to fix it with a simple setting. It's always this way in Linux: if you know how to do it, it's easy; if you don't know how to do it, it is a completely counterintuitive thing to figure it out. Hey, KDE creators --you ever test your product on newbies?
In this case, I am referring to KDE Control Center (on Mandrake 10, it's Menu > System > Configuration > Configure Your Desktop) > Accessibility > Keyboard Layout > Xkb Options
Anyway, here's what happens: you can make changes to the settings on your keyboard using the KDE Control Center, but you MUST set the "Reset old options" checkbox or else any changes you make are IN ADDITION TO the settings already present; contrary to what obviously seems like a display of settings status, when you UNCHECK a checkbox, it does NOT turn off that option! It merely FAILS TO SET that option (but if the option was already set, then there is no effect). The way to get around this is to check the box "Reset old options", which first turns everything off and then applies what you've selected.
How anyone at KDE could think that "Reset old options" was an appropriate label is beyond me. Why can't they call it "Retain previous settings" or "Don't retain previous settings"? Or, better yet, why don't they do away with that concept altogether and just make the options on or off as it shows in the checkboxes? If the box is checked, it's on. If the box is unchecked, it's off. Come on, it's not that hard to grasp.
Use xmodmap (better than xkb) to redefine keyboard: a primer
I have figured out how to get my R Alt key back; Mandrake Linux kept (re)defining the R alt key as the "Compose" key. In the process, I learned how to re-define the keyboard completely. Last time I said I'd use the KDE Control Centre to do this, but it didn't last; somehow, Mandrake keeps re-defining them. It looks like a Mandrake bug; its boot-up scripts keep reverting many changes that I've made in KDE.
Anyway, the reason my new method will work is because it is a command-line command, which means I can stick it into a script or access it directly, rather than relying on KDE GUI front-ends to interact properly. And it uses "xmodmap", which is easier to understand and use than "setxkbmap". The latter is part of the set of "xkb" utilities, which apparently "don't play well" with the "xmodmap" utility.
Anyway, here are some pointers to getting started with the "xmodmap" utility. To get the keyboard definitions, type
This outputs a list of how every single key is defined, but moreover, it outputs it in such a format that you can cut-and-paste each line back into the xmodmap command as an 'expression'.
For example, somewhere in the output from the above command were the lines:
keycode 24 = q Q at Greek_OMEGA
keycode 25 = w W lstroke Lstroke
keycode 26 = e E
keycode 27 = r R paragraph registered
keycode 28 = t T tslash Tslash
keycode 29 = y Y leftarrow yen
Obviously, keycode 24 is the Q key, which gives the letter 'q' by itself, 'Q' if you press the Shift key; and if you press the Mode_switch key (explained below), you get the 'at' sign, and Shift+Mode_switch, you get the capital 'Greek_OMEGA'. This tells us that the "xmodmap" command has some built-in names for the symbols; it knows that 'at' means the @ sign, and not the letters 'a' and 't'. I'm not sure how to get the complete list of symbol names yet.
Now, if you didn't want the Q key to put out the letter Q, but instead (for some silly reason) the letter A, then you would give this command:
xmodmap -e 'keycode 24 = a A at Greek_OMEGA'
Note that this is in the form 'xmodmap -e <expression>', where <expression> can be cut-and-pasted directly from the output of the 'xmodmap -pke' command above. This makes it easy to modify the keyboard to whatever it is.
The 'Mode_switch' key is like the Shift key in that it is used in combination with other keys to produce special characters. It appears in my list from the 'xmodmap -pke' command, as follows:
keycode 113 = Mode_switch
keycode 114 = Pause Break
keycode 115 = F13
keycode 116 = Multi_key
keycode 117 = Menu
From experimentation, I've found out that keycode 113 corresponds to the right Alt key. I don't want that to be 'Mode_switch' (a predefined name under xmodmap); I want the right Alt key to be the right Alt key, and the right Windows key (keycode 116) can be the Mode_switch key. So I type:
xmodmap -e 'keycode 113 = Alt_R'
xmodmap -e 'keycode 116 = Mode_switch'
And now I can happily use the R Alt key. The commands above can be stored in a script file that is run automatically at start-up. (How to do that will be a separate topic.)
If you want to store the list of keycodes in a file, just redirect the output as follows:
xmodmap -pke > your_keycode_filename
Hope that helps!
I don't know if this belongs in "success stories" or not.
|All times are GMT -5. The time now is 05:08 PM.|