Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!swrinde!elroy.jpl.nasa.gov!decwrl!pa.dec.com!shlump.nac.dec.com!netrix.nac.dec.com!lan_csse From: lan_csse@netrix.nac.dec.com (CSSE LAN Test Account) Newsgroups: comp.windows.x Subject: How do I remap the keyboard? Message-ID: <21867@shlump.nac.dec.com> Date: 8 Apr 91 16:45:43 GMT Sender: news@shlump.nac.dec.com Organization: Digital Equipment Lines: 38 We have an application that needs to redefine the keys on the keyboard to be different from the default. It is obvious that X contains support for this; it is equally obvious that I'm not making sufficient sense of TFM to actually do it, so... Two simple examples should suffice. Suppose, firstly, that I wanted to make this keyboard's command and period keys behave like they do on most ASNI terminals: shift+comma is '<' and shift+period is '>'. How would I do it? It seems that xmodmap should be able to do this, but damned if I can figure out the -e '...' expression to actually accomplish it. The result of the command xmodmap -pk | egrep 'comma|period|less|greater' on this system is: 201 0x003c (less) 0x003e (greater) 232 0x002c (comma) 0x002c (comma) 237 0x002e (period) 0x002e (period) What I'd like to do, I guess, is somehow copy the definitions for keycode 201 to the second columns of keycodes 232 and 237. I've experimented with lots of calls of xmodmap, but have gotten mostly error messages, and no changes to any of these definitions. Does anyone know how to do it? Another example is redefining a function key. Again, it is obvious that the intention was that I be able to do it; it is equally obvious that I'm not sufficiently intelligent to decrypt the descriptions in the manuals. An example here is that the key labeled "F5" sends the keycode 90, which is mapped onto keysym 0xffc2=F5. When I run a program and type an F5 at it, what it receives is the character string: 1B 5B 31 35 7E which is "\e[15~" in another notation. Suppose I wanted the F5 key to give the sequence "\e5F", or: 1B 35 46 in hex. How would I go about telling X that this is what I want? Or is this translation even done by X? I mean, xev tells me that the keysym F5 has an XLookupString that is 0 characters long, so maybe X isn't even doing it, but in that case, who might it be, and how do I make a deal with them? It sure seems that there oughta be some examples lying about, but I have had no success in finding them...