How to make Shift+Insert paste selection after closing window with selection

clipboardxorg

Typical scenario: I want to get a snippet from a text file into my terminal (probably running a VIM).

Now I open the file using mousepad, select the snippet, close mousepad, switch to urxvt and hit Shift + Insert to paste the text. (As opposed to non-terminal applications, where the same does the "normal" paste, but let's keep that aside for now).

IIRC, this work-flow used to work perfectly, until a certain moment. Now, since the moment I close the mousepad window, contents of the clipboard is lost, i.e. reverted to that before. Of course I don't want to keep the window open, that only leads to cluttered desktop (= random loss my concentration).

Skip this: Is there any rationale for this? I'm tempted to think that this is some kind of security measure, but frankly, that idea seems so scary to me: I mean, it's supposed to be clipboard, right? Not a VCS nor a password manager, just a plain old simple clipboard. (What next, are we going to have separate cursors in applications? Or separate selections? Or five hands?)

How can I get my old normal clipboard behavior? And by the way, which part of the architecture (X/GTK/Xfce/mousepad) is responsible for this behavior?

After-thought: After reading the first two great answer plus the article linked, I realized that yes, behavior might have changed, but it's more likely that I have misunderstood the clipboards for years, and it's more about changes in my work-flow (i.e. heavy use of vim, ssh and urxvt and keyboard-oriented control) that caused recent increase in my stumbling. (I feel relieved that it's not another instance of terrible trend in FOSS when developers are arbitrarily "improving" fundamentals of desktop tools.)

So while I was expecting a "switch to turn it back" to behave how it was how I understood it, namely retaining separate "Ctrl+X/C/V" and "MMB", I'll be looking into solutions involving The Grand Unification. Maybe I'll need to tune my work-flow, but at least I'll be understanding my tools.

Best Answer

Unix have two main "clipboards", the PRIMARY and the CLIPBOARD.More info in wikipedia the PRIMARY is the "select and paste with the mouse middle click" X11 style and the CLIPBOARD is the traditional copy&paste. Every time you select a text, the PRIMARY gets that text and it its lost when the text stop being selected. This is useful, but require training, as other systems don't require the selection to be active, people are used to click around before pasting and any click will lose the selection.

So what you want is the CLIPBOARD copy&paste that stays until a new CLIPBOARD is loaded. The main problem is that when you are going to do the paste, you may get the PRIMARY or the CLIPBOARD content, depending of the app and the way you use it.

fear not, there are many apps that solve this confusion, by synchronizing both PRIMARY and CLIPBOARD and even having a history, a huge help to manage copy&pastes.

There are many tools, like the Klipper and Glipper for kde and gnome, but many others for other WM and most of then are WM independent. I use parcellite, as its simple and works fine. Check here for many alternatives.

You can also search the net for "clipboard manager" for more info and apps

Related Question