chai@hawk.cs.ukans.edu (Ian Chai) (04/25/91)
Ok, I got requests to post a summary of the methods to do the
X -> vt100 keymap.
I got three methods:
1) Modifying xterm* stuff in .Xdefaults
2) Using xmodmap
3) Using a custom program someone wrote
Method 1: (Thanks to Alan Sengillo)
Add the following to your .Xdefaults. When you press the "L1" key the keypad
will emulate a vt100 keypad. When you press "L1" again, it will go back to it
orginal settings. I hope this helps.
xterm*sunFunctionKeys: true
xterm*VT100.Translations: \
#override <Key>L1: keymap(VT100)
!
!! Define keymapping for VT100
!!
!! SUN Key VT100 Key
!! R1 PF1
!! R2 PF2
!! R3 PF3
!! F7 PF4
!! R13 KP0
!! R10(Left) KP1
!! R11 KP2
!! R12(Right) KP3
!! R7 KP4
!! R8(Up) KP5
!! R9 KP6
!! R4 KP7
!! R5 KP8
!! R6 KP9
!! R15 ENTER
!! F8 KP -
!! F9 KP ,
!! R14(Down) KP .
!! F3 Up Arrow
!! F4 Down Arrow
!! F5 Left Arrow
!! F6 Right Arrow
!
xterm*VT100.VT100Keymap.translations: \
<Key>L1: keymap(None) \n\
<Key>R1: string("0x01b") string("OP") \n\
<Key>R2: string("0x01b") string("OQ") \n\
<Key>R3: string("0x01b") string("OR") \n\
<Key>F7: string("0x01b") string("OS") \n\
<Key>R13: string("0x01b") string("Op") \n\
<Key>Left: string("0x01b") string("Oq") \n\
<Key>R11: string("0x01b") string("Or") \n\
<Key>Right: string("0x01b") string("Os") \n\
<Key>R7: string("0x01b") string("Ot") \n\
<Key>Up: string("0x01b") string("Ou") \n\
<Key>R9: string("0x01b") string("Ov") \n\
<Key>R4: string("0x01b") string("Ow") \n\
<Key>R5: string("0x01b") string("Ox") \n\
<Key>R6: string("0x01b") string("Oy") \n\
<Key>R15: string("0x01b") string("OM") \n\
<Key>F8: string("0x01b") string("Om") \n\
<Key>F9: string("0x01b") string("Ol") \n\
<Key>Down: string("0x01b") string("On") \n\
<Key>F3: string("0x01b") string("OA") \n\
<Key>F4: string("0x01b") string("OB") \n\
<Key>F5: string("0x01b") string("OD") \n\
<Key>F6: string("0x01b") string("OC")
Method 2 (Thanks to Jim Pflugrath)
Feed this file to xmodmap:
===cut here==
! Last modified: 9-Sep-1990
!
! Input file for xmodmap. This file is used to re-map a Sun4 right keypad
! into a VT100 style right keypad.
!
! See 'man xmodmap' for more details.
!
! Usage: xmodmap this_file
!
! +-------+-------+-------+-------+
! Keycode| 28 | 29 | 30 | 105 |
! | | | | |
! VT100 | <- | -> | , |Nm_Lock|
! +-------+-------+-------+-------+
! | 52 | 53 | 54 | 78 |
! | | | | |
! | PF1 | PF2 | PF3 | PF4 |
! +-------+-------+-------+-------+
! | 75 | 76 | 77 | 132 |
! | | | | |
! | 7 | 8 | 9 | - | Shift 8 is Up
! +-------+-------+-------+ | Shift 4 is Left
! | 98 | 99 | 100 | | Shift 6 is Right
! | | | | , | Shift 2 is Down
! | 4 | 5 | 6 | |
! +-------+-------+-------+-------+ To get the Sun4 keys as labelled
! | 119 | 120 | 121 | 97 | on the keypad be sure that
! | | | | | Num_Lock is engaged (except for
! | 1 | 2 | 3 | E | the + key.
! +-------+-------+-------+ n |
! | 101 | 57 | t |
! | | | e |
! | 0 | . | r |
! +---------------+-------+-------+
!
keycode 28 = Left
keycode 29 = Right
keycode 30 = KP_Separator comma
keycode 52 = KP_F1 KP_Equal
keycode 53 = KP_F2 KP_Divide
keycode 54 = KP_F3 KP_Multiply
keycode 78 = KP_F4 KP_Subtract
!
! The Sun4 + key is really 2 VT100 keys: , and - so use the Shift modifier
! to mimic this. This means the loss of the normal Sun4 function
!
keycode 132 = KP_Separator KP_Subtract KP_Add
keycode 75 = KP_7
keycode 76 = KP_8 Up
keycode 77 = KP_9
keycode 98 = KP_4 Left
keycode 99 = KP_5
keycode 100 = KP_6 Right
keycode 119 = KP_1
keycode 120 = KP_2 Down
keycode 121 = KP_3
keycode 101 = KP_0
keycode 57 = KP_Decimal
keycode 97 = KP_Enter
======cut here========
Note: This is the method I used, except I didn't use this file as
I had a different keyboard, and so I used xev to figure out the
appropriate keycodes for my keyboard.
Method 3a: (Thanks to Bruce Barnett)
use vtttool. get it from titan.rice.edu under the name
sun-sources/vttool.shar.?
It provides keypads two ways:
it adds a panel next to a tty window that has mouse clickable
buttons in it.
It also suports keyboard remapping in a per-window basis.
xvttool is
written by Bruce
only does ASCII emulation (it uses termcap)
uses XView
Method 3b: (Thanks to Bob Mende Pie)
Bob has written a *hack* of a script that will define keyboard translations
for all xterms that are invoked after this script is run. It works on type
2,3 and 4 keyboards. It allows dynamid switching of numeric, sun, arrow, or
DEC application keypad. It is available for anonymous ftp in
athos.rutgers.edu /pub/xkeypad.shar
--
Ian Chai | "God loves you just the way you are, but
Internet: chai@cs.ukans.edu | He loves you too much to let you stay that
Bitnet: 2fntnougat@ukanvax | way." - Harry Poindexter
I don't believe in flaming. If I appear to be flaming, either (a) it's an