Keyboard shortcut to paste selected text to SECONDARY clipboard

clipboardx11

I am aware that mouse selection and CTRL+C adds content to the PRIMARY and CLIPBOARD X Selections but I need a keyboard shortcut(or mouse) to have the selected text in SECONDARY Selection.

Any leads would be very helpful.

Best Answer

It's impossible to define such a shortcut unless the application supports it. The notion of selected text is entirely within the application, there's no way to access it from the outside, and there's no way to ask the application for the selected text (except by using some application-specific protocol).

Many applications automatically copy the selected text to the primary selection — that's how the primary selection is supposed to be used (but, once again, this is a convention, not a system feature). Hence the suggestion to have a shortcut that copies the primary selection to the secondary selection, e.g. with xsel -o | xsel -s.

Related Question