I run Linux, and am used to selecting text with the mouse to copy and pressing Shift+Insert to paste. (This uses an alternate clipboard known as the "Primary Selection".)

This seems to work in every application besides Firefox. Firefox uses a different clipboard, where Ctrl+C copies and Ctrl+V pastes. Is there a keystroke or configuration change I can do to make Firefox paste from the Unix "primary selection" clipboard -- the one it pastes from when I click the middle mouse button?

Note: I'm looking for a keyboard shortcut, not a mouse action.

  • The usual keyboard shortcut to paste the PRIMARY selection is shift+insert. The problem in Firefox may be related to how GTK+ decided to associate shift+insert with the CLIPBOARD selection. GNOME bug 643391 has patches to allow shift+insert to be remapped to paste from the PRIMARY selection. I did not try these patches yet, but I'll give them a try at some point, as this now tends to break my interaction with all GTK+-based applications... – njsg Oct 11 '14 at 9:04
  • there is a similar question in the unix board, did you try the proposed solutions? unix.stackexchange.com/questions/11889/… – weberik Nov 10 '14 at 16:37

X11 has multiple clipboards: Selecting text with the mouse fills the "Primary Selection" and clicking the middle button inserts it. For Ctrl-V/Ctrl-C most programs use the "Clipboard", Shift-Ins seems to sometimes use the Primary Selection, sometimes the Clipboard.

So it's easier to not use Shift-Ins but either the Mouse or Ctrl-V/Ctrl-C to copy text between different applications.

  • 3
    If you're in an xterm, for example, the primary selection is your only option. – user2898 May 14 '10 at 20:41
  • "It's easier" is quite relative to the tools you normally use. Depending on the tools you use, it may be easier to not use Ctrl-V/Ctrl-C. – njsg Oct 11 '14 at 9:06
  • middle mouse button. that's what I use. (click the wheel) – Jasen Dec 9 '14 at 10:43

You can bind the following command to a key, it should make your firefox selection available to other programs:

xsel -b|xsel

and vice versa

xsel|xsel -b

In Linux, clicking the middle button (or scroll wheel) on the mouse should paste the contents of the Unix clipboard.

If you don't have a middle button on your mouse, clicking both the left and right buttons at the same time is often set up to emulate a middle-click.

  • 3
    Is there a way to do it without taking your hands off the keyboard? – user2898 May 14 '10 at 20:40
  • try Shift + Insert – spinus Nov 29 '14 at 1:11
  • @spinus I think the whole point is that shift+insert does not work with firefox. – iago-lito Sep 16 '18 at 8:42

The autocutsel util helped me...

I run this in my X startup script (~/.Xclients):

autocutsel -buttonup -fork

You can test it first in a terminal like so:

autocutsel -verbose

This util syncs CLIPBOARD with CUT_BUFFER0 (and vis-a-versa), so that a selection in rxvt (my "xterm" of choice) will paste in Firefox using its standard hotkeys.

  • But then you'll lose the distinction between those clipboards. I tend to use the mouse selection for more temporary stuff. Given that, clipit (sourceforge.net/projects/gtkclipit) is a nice clipboard manager, which would provide this feature, too. – blueyed Mar 29 '15 at 17:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.