Gnome-terminal - How to Copy selection to clipboard automatically?

I want to make gnome-terminal behave in such a way that when the end user selects a region on the terminal (with a mouse or mouse key), it gets automatically copied into the clipboard. Is it possible at all? If so, how?


Solution 1:

it's possible.

sudo apt-get install parcellite

then in the settings check "use primary" and "synchronize clipboards". it works.

Solution 2:

It should be in the X11 clipboard. (Not the same as the GTK clipboard). Press middle-click to paste.

Solution 3:

SOLVED: when using Clipit . Right click / Preferences / Settings : check: Use Primary selections and Synchronize clipboards.

It is also possible to put shortcut "Ctrl grave" for Manage hotkey (grave is the `), if you were used to Ditto from windows. If not, its handy anyways to have all your previous copies at hand and searchable.

Solution 4:

As you seem to be coming from a Windows environment I hope you are aware that the way copying and pasting works under X is a bit different from how it works under Windows. If not, for a quick introduction see Jamie Zawinski's excellent article on this subject matter X Selections, Cut Buffers, and Kill Rings.

In short: when you select some text this becomes the Primary selection (not the Clipboard selection). As others have pointed out you can paste from the Primary selection using the middle mouse button. Note however that if you close the application offering the selection, in your case the terminal, the selection is essentially "lost".

You can also use Shift+Ctrl+C in Gnome Terminal to explicitly "copy" something.

Solution 5:

On my Fedora 23, with gnome terminal 3.18.3

  • <Shift>+Selection for line
  • <Shift>+<Ctrl>+Selection for block

Once this is done you can use

  • <Shift>+<Insert> to insert IN ANOTHER terminal
  • the middle click everywhere else.