10

My middle mouse button pastes text I've highlighted.

Shift+Ins also pastes text, but sometimes it differs in what it pastes to what is pasted by clicking the middle mouse button.

What is the difference between pasting with the middle mouse button and Shift+Ins? Is Shift+Ins accessing the same buffer as Ctrl+V?

(I'm using Linux Mint distribution, if that makes any difference.)

1
  • Highlight + Middle Click Ctrl+Ins, Shift+Ins are different clipboards. Use it as per requirement. – user14517 Mar 8 '12 at 12:45
13

SHIFT+INS pastes the content of the clipboard, as you can see here. It is the same as CTRL+V (with the difference CTRL+V doesn't work for example in graphic terminals, there you have to use SHIFT+INS or the middle-mouse-click-trick).

When you select a piece of text, it will be loaded to an entirely other buffer than the buffer aforementioned (it is another clipboard, respectively), and you can use it with the middle mouse button, even without Xorg, in tty!

Ryran wrote: highlight + middle click isn't an xorg thing. Many distros support it out of the box on virtual consoles (ttys) as well. (e.g., RedHat/Fedora requires a package+service called gpm to be installed & running.) That said, each highlight + middle click clipboard is local to its tty (i.e., you can't highlight and paste between different virt consoles and/or X).

Summarized: in Xorg you have got two different clipboards. One is reachable with the keyboard, the other is with the mouse.

4
  • After simply highlighting text under Xorg, there is no keyboard shortcut to paste that text, right? – eoinoc Mar 8 '12 at 14:07
  • As far as I know, default keyboard shortcut for this doesn't exist in default installations. Certainly, you can change it if needed. – vakufo Mar 8 '12 at 14:15
  • 2
    highlight + middle click isn't an xorg thing. Many distros support it out of the box on virtual consoles (ttys) as well. (e.g., RedHat/Fedora requires a package+service called gpm to be installed & running.) That said, each highlight + middle click clipboard is local to its tty (i.e., you can't highlight and paste between different virt consoles and/or X). – rsaw Mar 8 '12 at 14:35
  • I will try it, @ryran, thanks the clarification. – vakufo Mar 8 '12 at 14:39
1

On my Linux computer, Shift+Ins pastes the same as Ctrl+V. Mouse select and than middle click is a different clipboard.

1

You are asking about the two distinct types of text selection and data exchange present in most if not all linux systems. This became important, as during development for Wayland (a full replacement of xorg) the question of keeping middle click paste, known as "primary selection", became a full on discussion. This turned out to be the best background I've seen written on the subject, as the team discussed whether or not to keep Primary Selection, the details of which are preserved here. I've reproduced the pertinent background information below, for the unlikely event that this stack exchange post outlives an arbitrary web url (I know, I said it was unlikely!):

X has a generic selection mechanism which lets application own arbitrary selections and exchange data via them. This is used both for DND as well as for clipboards. Historically, there has been some confusion about the intended semantics of multiple clipboards in X, but http://www.freedesktop.org/wiki/Specifications/clipboards-extension-spec/ has emerged as a more or less universal consensus as to how things should work under X:

  • the CLIPBOARD selection corresponds to explicit copy-paste actions of the user, normally bound to Ctrl-C/Ctrl-V
  • the PRIMARY selection always corresponds to the currently selected text (or other data) in the focused application, and middle-click pastes the contents of the PRIMARY selection into any context (typically a text entry or editor)

More details follow about the discussion and approach for re-implementing primary selection for Wayland, which was done (and works great!).

tl;dr: You'll find that middle click will paste the contents of the "Primary selection" buffer, which is filled by highlighting text, and most recently reimplemented in Wayland as distict from the clipboard system, just like it was in xorg.

0

[@ops This "minimum 50 reputation" thing is really annoying, I'm forced to answer in a different place than where I should!]

@eoinoc

After simply highlighting text under Xorg, there is no keyboard shortcut to paste that text, right?

You can use the "xsel" CLI tool to get the content of the currently selected text :)

For instance, I use it in the script below, that I've attached to a specific keybinding, which allows me to "read aloud" any (selected) text in any app...

#!/usr/bin/env bash
FIFO=/tmp/test.wav
LANG=$(cat /tmp/CURRENT_LANG || echo "fr-FR") # "en-US"
SPEED="1.6"
MAX_VOL="130"
mkfifo "$FIFO"
xsel | sed 's/^[[:print:]]//g' | sed 's/[[:space:]][[:space:]]*/ /g' | sed '/^\s*$/d' | pico2wave -w /tmp/test.wav -l $LANG & mplayer -softvol -softvol-max $MAX_VOL -af scaletempo -speed $SPEED "$FIFO" # -volume 100 -af volume=30:0
\rm "$FIFO"

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.