If you just want your clipboard to work, you should run a clipboard manager.
The lightest one I know of is xclipd
. Try this:
- Clone the
xclipd
repository and cd
to the folder.
- Run
make
.
- Now run
./xclipd
.
Until you terminate xclipd
, the clipboard will stay alive: you can use it even if the original application quits.
The clipboard is officially called the CLIPBOARD
selection, and the reason you’re losing the clipboard is that selections are peer-to-peer. By default, the applications are playing football with the CLIPBOARD
selection: if the selection belongs to program 1 and you copy or paste something in program 2, program 2 steals the selection from program 1. If you terminate a program while it’s holding the selection, the selection dies along with the program.
What a clipboard manager does is keep track of each selection from a central place, hold onto the contents in case an application quits, and answer the applications’ requests for copying and pasting and so on.
The answer to a similar question here has a good explanation of the clipboard under X, and the answer here on AskUbuntu has a good reading list for learning more.