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



Question:

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

I've been searching for a long time a way to emulate Putty's behavior in the default Ubuntu terminal:

  • left-click to select text and copies it into the clipboard
  • right-click to paste the content of the clipboard

The only solution I found, which works perfectly, is to patch the Gnome terminal (as you already guessed it).


Solution:6

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.


Solution:7

Just tried parcellite and it works great. Installed on Fedora using "yum install parcellite" command and clipboard icon appears in the gnome applet area. Right-click -> preferences -> check "use primary" and "synchronize clipboards" and yes it works just like an xterm. It also keeps a clipboard history. Love it! Thanks @fastmultiplication.


Solution:8

It used to be the default behavior in gnome-terminal as well -- but then usability experts got ahold of Linux distros, and deemed copy & paste to be too risky an activity for kernel hackers to be involved in.

But on Fedora (at least) it recently came back -- right click in your terminal and go to "input method" and select "X input method" -- you now have highlight to copy.

If you have a three button mouse, it can be pasted with the middle button (as mentioned above) but to get right click paste -- well, um...


Solution:9

You can also install pterm a Putty like terminal emulator, that allows for the current selection to be pasted with a middle button click.


Solution:10

I use Debian Wheezy and Gnome terminal and found a good solution is to install xsel which provides the correct copy function in the terminal.

Mouse-left-drag to select/copy text to clipboard, and I paste into vim using shift+insert keys, which are defined in Gnome terminal menu, edit, keyboard shortcuts. You can define alternative keys if wanted.


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »