Make terminal selection automatically copy to the system clipboard buffer

clipboardx11

Is there a way to have terminal applications (gnome-terminal, terminator, etc) automatically move selected text to the CLIPBOARD system buffer, and not just the PRIMARY (i.e. terminal-local) buffer?

I found this which describes the primitives, but not to the extent that I could make the behavior change: primary / clipboard intro

I've got a specific hosted VM use case where I'm very frequently copying text from a bash or vim session in the linux guest back to the windows host… and after 20 years of linux I'm so used to the buffer "just being there" that I'm trying to replicate that behavior…

Best Answer

The primary is not local to the terminal, you can paste it in other X applications by using the middle mouse button.

What you should install is autocutsel:

Autocutsel tracks changes in the server's cutbuffer and CLIPBOARD selection. When the CLIPBOARD is changed, it updates the cutbuffer. When the cutbuffer is changed, it owns the CLIPBOARD selection.

On my Ubuntu 12.04 system I can just install this with apt-get install autocutsel, your distro might have it as well.