[comp.windows.x] Managing xterm keyboard translations

tmcconne@berger.intel.com (Tom McConnell) (05/03/91)

In article <9104161815.AA28888@cas.org>, lwv27@LOCAL.UUCP (Larry W. Virden) writes:
> Has anyone found a method to deal with the following problem?
> 
> We want to define a set of sequences for unshifted function keys 
> under xterm.  We want users to get these by default.  If the user
> would like to define the shifted, meta-d, etc. function keys, we
> would like for the user to be able to 'merge' those definitions
> into the xterm environment.  Thus, they would not copy our xterm
> resources and add to them - they would append to the xterm
> environment.
> 
> The reason that we want to do this is so that as needs change, we can
> change one file rather than expect 500 folks to have to make the
> change.
> 
> When I read the xterm man page on my system, I don't see any
> mechanism to define things this way.  It looks like I have
> to define every key any time I want to change the definition for
> any one key.  Is this really the case?  Is there anything folks
> have done to work around this?  Perhaps generating the translation
> dynamically?
> 
> -- 
> Larry W. Virden
> Business: UUCP: osu-cis!chemabs!lwv27  INET: lwv27%cas.BITNET@CUNYVM.CUNY.Edu
> Personal: 674 Falls Place,   Reynoldsburg,OH 43068-1614
> Pro-Line: lvirden@pro-tcc.cts.com   America Online: lvirden   CIS: [75046,606]

	We have a similar sort of thing. What we do is have several X
resource files, formatted like the .Xdefaults file. These files are
loaded into the "Resource_Manager" space using xrdb. When we want to
change the resources, including the key translations for the xterm
window, we do:

	% xrdb -q > tmp1
	% awk '<parse out the stuff you want to change>' tmp1 > tmp2
	% xrdb -load tmp2
	% xrdb -merge <new_resources>

	This method is a superset of the FAQ:
.
.
----------------------------------------------------------------------
Subject:  15)* How do I remap the keys on my keyboard to produce a string?

        There is no method of arranging for a particular string to be
produced when you press a particular key. The xmodmap client, which is useful
for moving your CTRL and ESC keys to useful places, just rearranges keys and
does not do "macro expansion."
        Some (few) clients, including xterm and several X-based editors,
accept a translation resource such as:
        xterm*VT100.Translations: #override \
                <Key>F1: string("setenv DISPLAY unix:0")
which permits the shorthand F1 to be pressed to reset the display locally
within an xterm; it takes effect for new xterm clients.
        Window managers, which could provide this facility, do not yet; nor
has a special "remapper" client been made available.
----------------------------------------------------------------------
.
.

	A more complete example is given by chai@hawk.cs.ukans.edu
(Ian Chai) in his program to dynamically remap SUN keyboards. This is
available by anonymous ftp in athos.rutgers.edu /pub/xkeypad.shar.

	Hope this helps.

--Tom
--
 Tom McConnell          |     Internet: tmcconne@berger.intel.com
 Intel, Corp. C3-21     |     Phone: (602)-554-8229
 5000 W. Chandler Blvd. | The opinions expressed are my own. No one in 
 Chandler, AZ  85226    | their right mind would claim them.