I'm using xterm which comes with a set of default translations as enumerated in the man page. To #augment or #override the translations I edit my $XAPPLRESDIR/XTerm file; this works as expected.

However, I can't find a way to remove a particular default translation (and have the event passed to the application running in xterm).

Specifically, I want the Meta <Btn2Down> event to be passed to the application. The xterm default translations bind this to the clear-saved-lines() action with

Meta <Btn2Down>:clear-saved-lines() \n\

What do I need to do for the application to receive the Meta-Btn2Down event?

  • 2
    events are never based to the application running in xterm. That wouldn't make sense, those applications are not even connecting to the X server. If you want Meta+Btn2 to insert a selection, remap it to insert-selection(...). – Stéphane Chazelas Jan 6 '15 at 13:49
  • @StéphaneChazelas I don't want to insert a selection; I want xterm to pass the event to my application as-is, like it does with other mouse events when in mouse tracking mode (e.g. started with printf "\033[?1000h\n"). Right now, if xterm consumes the event, the application won't see it. – Jens Jan 6 '15 at 13:56
  • @StéphaneChazelas If it is as you say, then that would be a documentation bug. ctlseq.txt says: "The next three bits encode the modifiers which were down when the button was pressed and are added together: 4=Shift, 8=Meta, 16=Control. Note however that the shift and control bits are normally unavailable because xterm uses the control modifier with mouse for popup menus, and the shift modifier is used in the default translations for button events." My understanding was that I can get past the normally unavailable by tweaking translations. – Jens Jan 6 '15 at 17:59

As I understand it, there is no function in X Toolkit which can remove a translation. You can override or augment but not selectively remove a part of a translation table.

That was one of the reasons for adding the omitTranslation resource in patch #269. With that version, the translations table is broken up into more manageable parts which allows somewhat better customization:

Selectively omit one or more parts of xterm's default translations at startup. The resource value is a comma-separated list of keywords, which may be abbreviated: "fullscreen", "scroll-lock", "shift-fonts" or "wheel-mouse". Xterm also recognizes "default", but omitting that will make the program unusable unless you provide a similar definition in your resource settings.

However, agreeing with StéphaneChazelas, it is unclear how you would effectively use the proposed change because the escape sequences which are passed to the application are constructed inside xterm based on button-events. Perhaps you could make a special translation which used a string action.


If you are looking for already-binded keys to be passed without xterm handling it, propably you are looking for insert() or insert-eight-bit() actions.

From xterm man page:

This action inserts the character or string associated with the key that was pressed.

This action inserts an eight-bit (Meta) version of the character or string associated with the key that was pressed. Only single-byte values are treated specially. The exact action depends on the value of the altSendsEscape and the metaSendsEscape and the eightBitInput resources. The metaSendsEscape resource is tested first. See the eightBitInput resource for a full discussion.

The term “eight-bit” is misleading: xterm checks if the key is in the range 128 to 255 (the eighth bit is set). If the value is in that range, depending on the resource values, xterm may then do one of the following:

  • add 128 to the value, setting its eighth bit,
  • send an ESC byte before the key, or
  • send the key unaltered.

For example,

Meta <Btn2Down>:insert-eight-bit() \n\

PS: I just solved the same problem to avoid the biding Alt <Key>Return:fullscreen() \n\, to be able to pass Alt-return to an application.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.