I would like to enable Ctrl+C for copy and Ctrl+Shift+C for SIGINT/interrupt in xterm.
I have found the following.
XTerm*VT100.Translations: #override \
Shift Ctrl<Key>V: insert-selection(CLIPBOARD) \n\
Shift Ctrl<Key>V: insert-selection(PRIMARY) \n\
Shift<Btn1Down>: select-start() \n\
Shift<Btn1Motion>: select-extend() \n\
Shift<Btn1Up>: select-end(CLIPBOARD) \n\
which I believe is partially there but doesn't give a demonstrate how to override Ctrl+C.
Best Answer
That's "partially there", but runs into the problem that there is no predefined (single byte) character corresponding to Ctrl+Shift+C or Ctrl+Shift+V. You need that single byte character for the interrupt (
intr
) setting withstty
. Likewise, control+V is the literal next (lnext
) setting instty
.You could use the translation resource to send a Ctrl+C character using the
string
feature, e.g., something like these lines in atranslations
resource:and then assign the unshifted keys (putting a tilde
~
before the `shift keyword).From the followup comment, I agree that just specifying the unshifted pattern should be enough:
a few notes (which might be documented, but the source code helps):
<KeyPress>
means the same as<Key>
<KeyPress>
) are matched ignoring case.:
are case-sensitive.Normally there is no translation done for Ctrl+C with or without the shift-modifier. xterm simply gets an
XKeyEvent
which has the modifier information and the character, and decodes that. Thetranslations
resource alters the events which might be sent to xterm.You would use modifiers in a translation to limit the matches, e.g., omitting Shift means it matches whether or not the shift-key is pressed. Adding an explicit
~shift
(noshift) modifier has no effect on the match forshift
.Further reading: