[comp.windows.x] Assigning strings to keys

mhoffos@janus.mtroyal.ab.ca (02/16/91)

This may be a simple question, but how do you (if it is possible) assign a
string to a function key?  Background:  I am using Herr Roell's X server for
SYSV/386, and I would like to define F1,F2,F3, and F4 to be PF1, PF2, PF3, PF4
(as on a vt100 terminal).  Since this probably isn't of much general interest,
to save bandwidth it is probably best just to reply directly to me. Thanks in
advance.

(I am sure that you can use xmodmap for this, but I have no ideas what the
incantations are.)

Mike Hoffos
--
mhoffos@janus.mtroyal.ab.ca
(Mount Royal College is a community college in Calgary, Alberta)

Disclaimer:     Mount Royal College doesn't speak for me, and I *certainly*
                don't speak for it.

mouse@lightning.mcrcim.mcgill.EDU (02/18/91)

> This may be a simple question, but how do you (if it is possible)
> assign a string to a function key?

In general, you don't.  In some specific cases, you can come close.

> Background:  I am using Herr Roell's X server for SYSV/386, and I
> would like to define F1,F2,F3, and F4 to be PF1, PF2, PF3, PF4 (as on
> a vt100 terminal).

Presumably by "define F1 [...] to be PF1 [...]" you mean you want it to
generate the corresponding escape sequence when typed to an xterm.

> Since this probably isn't of much general interest,

This actually is one of the Frequently Asked Questions here.  From the
FAQ posting:

----------------------------------------------------------------------
Subject: 56)  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 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.  However, this doesn't work across all clients.
	Window managers, which could provide this facility, do not yet; nor
has a special "remapper" client been made available.

----------------------------------------------------------------------

At the recent X conference, there was talk of an input manager facility
of some sort.  I have no idea what the details will be like, but one
might hope that it will have some sort of support for things like this.

					der Mouse

			old: mcgill-vision!mouse
			new: mouse@larry.mcrcim.mcgill.edu