Xterm and the clipboard

It has long been an annoyance that xterm doesn’t follow the same rules with regard to the clipboard as most GTK/Gnome applications.
Xterm by default only uses the PRIMARY selection for copy and paste, and follows the implicit selection model where the selection is set immediately when text is selected with the mouse, without any further action from the user.
Most GTK/Gnome applications uses both an implicit selection model with the PRIMARY selection, and an explicit selection model with the CLIPBOARD selection.
I don’t know of any way to get xterm to behave like most other applications, but this little set of X ressources will enable the use of the CLIPBOARD selection in xterm, when the Shift key is down.

XTerm*VT100.Translations:    #override
	Shift<Btn1Down>:		select-start()
	Shift<Btn1Motion>:		select-extend()
	Shift<Btn1Up>:			select-end(CLIPBOARD)
	Shift<Btn2Up>:			insert-selection(CLIPBOARD)
	Shift<Btn3Down>:		start-extend()
	Shift<Btn3Motion>:		select-extend()
	Shift<BtnUp>:			select-end(CLIPBOARD)

Comments

One response to “Xterm and the clipboard”

  1. BigSmoke » Copy-pasting to and from XTerms

    […] Xterm and the clipboard by René Seindal […]

Leave a Reply

Your email address will not be published. Required fields are marked *

To respond on your own website, enter the URL of your response which should contain a link to this post’s permalink URL. Your response will then appear (possibly after moderation) on this page. Want to update or remove your response? Update or delete your post and re-enter your post’s URL again. (Find out more about Webmentions.)