[comp.windows.x] vt100 fkeys in Xterm

cml@care.cs.umd.edu (Christopher Lott) (05/22/91)

I needed to talk to a database forms package that required vt100 function keys,
so I added the following to my .X11defaults file.  This was for a sun3 running
X11R4.  A mapping for the sparc would be nice; I haven't found the time for
that yet.  The sparc has a keypad that matches the vt100 much more closely. 
These mappings let me talk to that unfriendly system rather nicely.  Note
that these settings are active in all xterm windows, which was fine by me.

Hope this helps someone.   Please excuse this post if 42 of these things
have gone by already.

Comments, questions, improvements:  please email, I'll summarize.

chris...

-----snip, snip-------
! 
! cml 910429 get vt100 function keys on a sun keyboard
! this goes in file .X11defaults
! the escape char is hex 1b
! borrowed and rewritten from the xterm man page
!
! function keys L1 - L4 correspond to PF1 - PF4
! L1 = PF1			(esc O P)
! L2 = PF2			(esc O Q)
! L3 = PF3			(esc O R)
! L4 = PF4			(esc O S)
! function keys F1 - F9 correspond to keys on the numeric keypad, 1-9
! F1 = 1, next block		(esc O q)
! F2 = 2, previous block	(esc O r)
! F3 = 3, clear block		(esc O s)
! F4 = 4, next record		(esc O t)
! F5 = 5, previous record	(esc O u)
! F6 = 6, clear record		(esc O v)
! F7 = 7, next field		(esc O w)
! F8 = 8, previous field	(esc O x)
! F9 = 9, clear field		(esc O y)
! function keys R1 - R5 correspond to other keys on numeric keypad
! R1 = Enter			(esc O M)
! R2 = -			(esc O m)
! R3 = ,			(esc O l)
! R4 = .			(esc O n)
! R5 = 0			(esc O p)
!
!
XTerm*VT100.Translations: #override \
              <Key>L1: string("0x1b") string("OP") \n\
              <Key>L2: string("0x1b") string("OQ") \n\
              <Key>L3: string("0x1b") string("OR") \n\
              <Key>L4: string("0x1b") string("OS") \n\
              <Key>F1: string("0x1b") string("Oq") \n\
              <Key>F2: string("0x1b") string("Or") \n\
              <Key>F3: string("0x1b") string("Os") \n\
              <Key>F4: string("0x1b") string("Ot") \n\
              <Key>F5: string("0x1b") string("Ou") \n\
              <Key>F6: string("0x1b") string("Ov") \n\
              <Key>F7: string("0x1b") string("Ow") \n\
              <Key>F8: string("0x1b") string("Ox") \n\
              <Key>F9: string("0x1b") string("Oy") \n\
              <Key>R1: string("0x1b") string("OM") \n\
              <Key>R2: string("0x1b") string("Om") \n\
              <Key>R3: string("0x1b") string("Ol") \n\
              <Key>R4: string("0x1b") string("On") \n\
              <Key>R5: string("0x1b") string("Op") \n
-----snip, snip-------
-- 
Christopher Lott \/ Dept of Comp Sci, Univ of Maryland, College Park, MD 20742
  cml@cs.umd.edu /\ 4122 AV Williams Bldg  301 405-2721 <standard disclaimers>

rob@spot.Colorado.EDU (Rob Cuthbertson) (05/25/91)

I also face the problem of getting vt100 PFkeys while under X, but I'm 
looking for a more general solution than using Xdefaults translation tables 
or xmodmap.  I move between several different X workstations, including
Sun and HP workstations, NCD Xterminals, and Macs running X.  What I'd like
is a small application that brings up a window with four pushbuttons along
the top, and a normal xterm just below.  Basically a candy-wrapper shell
around an xterm window.  
(the four buttons, of course, would be labeled "PF1" - "PF4" and would
send the correct escape sequences to the xterm)

What is the best way to do this?  Is there an easy way to write an extra 
application that uses the existing xterm or should I look at modifying
the xterm code to make a new copy? (pfxterm?  8)

Alternately, if someone has done something similar to this, (or if someone
would like to...)  I'd be quite happy to go with someone else's work.

--Rob Cuthbertson, rob@spot.Colorado.EDU

Project: World Peace
No Plan.