Mapping combo to key and key to combo

Matthijs Kooijman matthijs at stdin.nl
Thu Aug 27 01:29:04 PDT 2009


Hi,

> generally speaking, that's (in the context of X) a feature of the 
> applications that you're using.  For instance, xterm supports this using 
> the X Toolkit's translations resource.  (Some other widely-used 
> applications offer no support for what you're asking - ymmv).
Hah, that's useful. I've been looking for a way to translate Ctrl-l to insert
λ for a while now, using the translations resource of xterm this now works:

UXTerm.vt100.translations:        #override \
  Ctrl <KeyPress> l: string(λ)

It seems this mechanism is also useful for what the OP wants, but it is indeed
application specific. You should therefore not try to map F13 to shift+home,
but map it to whatever function shift+home performs. I'm not so sure how to
get to the default translation table, this should probably be documented with
your application. For Xterm, you can find a list of possible actions to bind
to keys under ACTIONS in the manpage.

It took me a while to find a decent reference on translation tables. The X
Toolkit Programming Manual [1] provides some, in particular in appendix B [2].

When specifying multiple translations in a single table, don't forget to
separate them with "\n" (and also include another \ for line continuation).
e.g.:

UXTerm.vt100.translations:        #override \
  Ctrl <KeyPress> l: string(λ) \n\
  Ctrl <KeyPress> x: string(λ)

For the keysyms to use instead of "l" above, see [3].

Replying to another post in this thread, I don't think xmodmap and xbindkeys
provide a solution. AFAIK xmodmap only maps keycodes and keysims, e.g., single
keypresses without allowing to specify modifiers. xbindkeys only allows you to
bind keys to run programs, not other keys.

I hope this helps a bit, it did the trick for me anyway. Thanks!

Matthijs

[1]: http://lesstif.sourceforge.net/doc/super-ux/g1ae03e/part1/chap10.html#Translation%20Management
[2]: http://lesstif.sourceforge.net/doc/super-ux/g1ae03e/part1/appb.html
[3]: http://wiki.linuxquestions.org/wiki/List_of_keysyms
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 197 bytes
Desc: Digital signature
URL: <http://lists.x.org/archives/xorg/attachments/20090827/2d7a071f/attachment.pgp>


More information about the xorg mailing list