Redefining Xterm keys

STRIANTAFYLL%34985.gm at hac2arpa.hac.com STRIANTAFYLL%34985.gm at hac2arpa.hac.com
Wed Jul 4 00:20:02 AEST 1990


| auspex!guy at uunet.uu.net (Guy Harris) writes:
|>Has anyone ever tried to remap a keyboard under openview/xnews?  I am
|>trying to redefine the keyboard with the vt100 keys PF1,2,etc.  'Loadkeys'
|>doesn`t work,
| 
| Not surprising at all.
| 
| [...]
|
| X11, NeWS, and X11/NeWS servers run the keyboard in "untranslated events"
| mode; X11 sends raw keycodes over the wire to clients, and I believe the
| lowest-level PostScript code receives those as well.
| 
| For X clients, you could use "xmodmap", except that only changes, in
| effect, the "labels" on keys; it doesn't provide any way to "program" a
| key with an escape sequence.  Some applications may let you do that kind
| of programming.

I have the same problem, using Xterm to get on to the VAXes for
All-in-1...  Our environment is Sun 386i (type 4 keyboard) running
OpenLook 1.01 sales pre-release) After tinkering around with NO manuals
(our Open* order is lost in space somewhere) here is what I came up with:
(piece from my .Xdefaults)

xterm*VT100.translations: #override \
    <Key>F9:  		string(0x1b) string("[A") 	\n\
    <Key>F10: 		string(0x1b) string("[B") 	\n\
    <Key>F12: 		string(0x1b) string("[C") 	\n\
    <Key>F11: 		string(0x1b) string("[D") 	\n\
    <Key>F8:		string(0x1b) string("Op")	\n\
    <Key>F7:		string(0x1b) string("OS")	\n\
    <Key>F6:		string(0x1b) string("OR")	\n\
    <Key>F5:		string(0x1b) string("OQ")	\n\
    <Key>F4:		string(0x1b) string("OP")	

This remaps F9-F12 to up,down,left,right, and F4-F8 to PF1-PF4 and EXIT to
keep All-in-1 happy. I could have mapped it on the R keys, i.e. on the
right hand keypad, but I am used to a VT100 :-). Of course, any VT fan
would immediately recognize the ESC [ A etc as being the key codes that
the VT sends. 

Once this piece of code has been added to your .Xdefaults, then all you
need to do is xrdb -load ~/.Xdefaults and any new X terminals you create
are set up OK. The manual for Xterm specifies a sequence upon which
mappings would change based on the program running but I did not have any
luck. The best I got was to use a key to switch the mapping on and off...
i.e. a toggle. Also I do not remember if ALL the keys were mappable. I.e.
I think I had trouble with F1... 

xmodmap is useful in getting the key codes but not for doing any large
scale modifications.

Spiros Triantafyllopoulos		  Kokomo, Indiana 46902
Workstation Software Tools		  striantafyll at kosds1.gm.hac.com
Delco Electronics, General Motors Corp.   ELECTRONICS is who we are!!!



More information about the Comp.sys.sun mailing list