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.
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It only takes a minute to sign up.Sign up to join this community
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.
I'm not aware of any secondary clipboard (other than having Clipman running — I use Xfce4). What I often do is select text and paste with the middle-click mouse button.
Whenever I need two simultaneous (and convenient) copy/paste paths I select some text, either with the keyboard or mouse, press Ctrl + C, select some other text then use the middle click button and Ctrl + V shortcut whenever appropriate. The order doesn't matter as long as I don't select anything.
Many applications do move the pointer where the middle click occurs. This makes aim/paste simultaneous.