How
to change the keyboard map (mapping underscore to the Win key)?
Okay, why would one ever want to do this?? Have you ever come across the problem of typing just too many underscores when making meaningful identifiers while programming (in C)..... well, I did - and this was the easiest way out to save myself from pressing the Shift key too many times. You could use this technique to map any key to any other key on the keyboard - but I am using underscore as the example here. There are basically two keyboard maps in Lnux, one for the X Window and the other for the text mode(virtual consoles). Note, that xterms (or other terminal emulators like konsole) will come in the X-Window section. Changing Keyboard maps in X-WindowFirst of all some theory - the keyboard map is divided into two parts the keycodes and the keysyms. The keycodes are generated by the keyboard driver when a key is pressed. But X doesn't recognize the raw keycodes. It works with keysyms. So, to get a particular key to be recognized under X, you have to map it to some keysym. The mapping of keycodes to keysyms is may-to-one, ie you can have X generate the keysym for 'underscore' when you press the keys 'a' or 'b' (in case youd ever want to do that!!)The utility whith which we are considered is ''xmodmap'' Check out its man page for all the options it offers. What you'll basically need is: $ xmodmap -e "keycode 117 = underscore"This is telling xmodmap to map the keycode 117 to the keysym 'underscore'. The keycode 117 is for the WinMenu key (the one right next to the Right Control key) on my keyboard. Now comes the next question - how does one come to know what keycode is generated for which key? Its pretty simple, just use the "xev" utility. $ xevIt'll open up a small window, whatever you do in that window (mouse movement, mouse clicks, key presses) will be displayed in the terminal.
Have a Linux Issue?
Linux Home: Linux System Administration Hints and Tips (c) www.gotothings.com All material on this site is Copyright.
|