Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!apple!well!bschoen From: bschoen@well.sf.ca.us (Brook Schoenfield) Newsgroups: comp.windows.x Subject: Re: How do I remap the keyboard? Summary: Remapping keys programmatically Keywords: XGetKeyMap Keyboard Xwindows Message-ID: <24228@well.sf.ca.us> Date: 16 Apr 91 04:50:24 GMT References: <9104102309.AA00552@lightning.McRCIM.McGill.EDU> Organization: Whole Earth 'Lectronic Link, Sausalito, CA Lines: 37 >> 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; > >After a fashion. The X protocol contains support for remapping the >keyboard in the sense of changing the mapping between physical keys >("keycodes") and logical keys ("keysyms"). Xt, and some (most? all?) >clients that use it, has/have support for mapping (logical) keys to >mostly-arbitrary actions. > YOu don't say whether you want to programmatically change the key bindings for this one application (i.e., by coding in the app), or get some trickery to rebind while running this application or if you want to change the mappings for the server. Der Mouse is right on for the last case, and actually has the answer for the second case (though you will need to ln a different name for xterm and set your translations for that. Xterm can be told to run a program on its command line, thus making a very clean entry and exit into a non x program). However, if its the first case: you want to code an app to rebind keysyms: that is a bit more complicated. There is some excellent sample code for this in Oliver Jones' book, Programming X Windows. Beware that you must rebind each modifier grouping that a particular key may experience separately: for instance, if you want an unshifted '.' to reamin that when the numlock is down, you'll have to rebind both the unshifted case and the numlock case: this leads to alot of rebindings when you have to change large parts of a keyboard. -- Brook Schoenfield bschoen@well.sf.ca.us