Posts Tagged ‘clipboard’

Xterm and the clipboard

Thursday, June 16th, 2005

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)

With GNU Emacs you can always learn

Sunday, June 5th, 2005

It is close to twenty years that I have been using GNU Emacs almost daily, and you still figure out new stuff.

I’ve been somewhat annoyed that copying and pasting between Emacs and Gnome applications were so inconsistent, and then its all in the manual:

Using the Clipboard

As well as the primary and secondary selection types, X supports a “clipboard” selection type which is used by some applications, particularly under OpenWindows and Gnome.

The command `M-x menu-bar-enable-clipboard’ makes the `Cut’, `Paste’ and `Copy’ menu items, as well as the keys of the same names, all use the clipboard.

You can customize the option `x-select-enable-clipboard’ to make the Emacs yank functions consult the clipboard before the primary selection, and to make the kill functions to store in the clipboard as well as the primary selection. Otherwise they do not access the clipboard at all. Using the clipboard is the default on MS-Windows, unlike most systems.

Maybe its time to read it again.