|
|
Log in / Subscribe / Register

Clipboard selection

Clipboard selection

Posted Apr 3, 2018 5:41 UTC (Tue) by eru (subscriber, #2753)
Parent article: A look at terminal emulators, part 1

One property of the various terminals you might comment on is: Can you copy text to "clipboard" and back? This is one messy aspect of X11. The classic xterm seems to support only "primary selection", and a few years ago I found this is problem because some applications expect the data to be pasted only in "clipboard". So I reluctantly started to use XFCE-4-Terminal, where ctrl-shift-C places the selected data there.

(By the way, the stuff about pasting innocent-looking evil texts literally gave me a nightmare, where I tried one of the examples, and it infected my computer with ransomware... should not to read lwn.net in the bed just before sleeping...)


to post comments

Clipboard selection

Posted Apr 5, 2018 10:09 UTC (Thu) by grawity (subscriber, #80596) [Link] (2 responses)

You can actually bind the same keys in xterm via ~/.Xresources:

XTerm*vt100.translations:	#override			\n\
	Shift Ctrl <Key>C:	copy-selection(CLIPBOARD)	\n\
	Shift Ctrl <Key>V:	insert-selection(CLIPBOARD)	\n\
	Shift Ctrl <Key>N:	spawn-new-terminal()		\n

(If you wanted to do the same in urxvt, you would need to load a perl script into it.)

Clipboard selection

Posted Apr 7, 2018 11:05 UTC (Sat) by eru (subscriber, #2753) [Link]

Thanks! Now I can go back to the One True Terminal Emulator. Only problem is some of that stuff is not supported on older xterm versions. The copy-selection appears in patch Patch #267 - 2010/11/20 (https://invisible-island.net/xterm/xterm.log.html), the RHEL/CentOS bundled ones (which I often need to use) may be older, depending on the particular RHEL version. But on non-ancient distributions your solution works fine.

Clipboard selection

Posted Apr 17, 2018 19:26 UTC (Tue) by Ross (guest, #4065) [Link]

Or if you liked Macs, Motif (probably not), or other non-Windows systems, or just don't like using two modifiers, "alt" makes a nice choice:

Alt <KeyPress>c: select-set(CLIPBOARD)\n\
Alt <KeyPress>v: insert-selection(CLIPBOARD)\n\

If you like to use PRIMARY selections (highlight/middle-click), you might find that alt-spacebar is a convenient way to paste:

Alt <KeyPress>space: insert-selection(PRIMARY,CUT_BUFFER0)\n\

(CUT_BUFFER0 is a fallback there to the old cut buffer system which is useless except it works after the source window has been closed if it supports cut buffers, which xterm does)


Copyright © 2026, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds