Ask HN: What happend to center mouse cut and paste in Linux?

22 points by bdavis__ ↗ HN
Been captive on RHEL 6 for a long time. Installed a new linux distribution (fedora) and found that center button cut and paste does not work. Installed ubuntu, same thing. Google search seems to tell me "that is the way it is", and you can only cut and past like that inside a single application (which for me means an xterm). What has happened? Why would something like this that has been around for 30+ years across ever unix / window manager environment not be supported?

24 comments

[ 3.1 ms ] story [ 71.2 ms ] thread
(comment deleted)
Uh, if still works though?

On both fedora and Ubuntu.

Ah, on second thought: it might be because of Wayland. I've been using i3 so haven't been able to switch from x-land... So I wouldn't have encountered that problem

Works for me on fedora 27 and 28, also using wayland.
> I've been using i3 so haven't been able to switch from x-land

Check out Sway.

not an option, unless you own an AMD or nouveau supported card.
Works on CentOS 7 and recent Ubuntus. Might be an issue with GNOME 3 getting dumbed down and all.
GNOME 3 session uses Wayland now by default, so I wouldn't be surprised if it worked only for X11 clients or so.
Fedora uses Wayland if your drivers support it (i.e., i915 Intel does, Nvidia blob does not). As a result different users may have a different experience.

FWIW, CentOS 7 is ancient and long predates Wayland in Fedora.

It still works for me in Debian stable, with either GNOME 3 or MATE. I'd be sort of surprised if both Fedora and Ubuntu disabled it by default but it's possible.

One thing to remember is that the middle-click clipboard it's a separate clipboard from the Ctrl-C/Ctrl-V one. It's called the "primary selection", and as the name implies, it's updated if you select something new or even unselect the old selection. And nothing automatically synchronized with the Ctrl-C/Ctrl-V clipboard, so if you select something, copy it, and unselect it, middle-click won't work to paste any more but Ctrl-V (or Edit | Paste) still will.

If you want them synchronized you can use two autocutsel processes to do this (autocutsel synchronizes between either the "primary selection" or the "clipboard selection," and yet another type of X11 clipboard called the "cut buffer", so you need two to sync each selection with the cut buffer). https://blog.nelhage.com/2008/09/autocutsel/ describes how to do it. You might have had something like this in your RHEL 6 dotfiles that didn't get copied over to your new system.

Support for the often confusing X11 clipboard - aka CLIPBOARD/PRIMARY - predominantly depends on the toolkit (think GTK, Qt) your particular application uses. I'm very fond of Mark=Copy and Ctrl+Insert/MiddleClick=Paste, and to teach all the (modern) applications I also use to honor my preferences, I have a clipboard manager installed. My choice is XFCE's `clipman`, but all the popular and big desktop environments offer their own, functionally at least equivalent application for the purpose: KDE has "klipper", for example, while GNOME probably sports an extension that does the job. There are more standalone implementations, too, that don't target a specific DE at all.

Running one in your session allows to sync the toolkits' clipboards with X11's clipboard, which is what I choose to do - you only have one (history-enabled) clipboard that way, but it keeps the surprise effect ("Oh... I wasn't aware I was gonna paste _that_...") to a minimum, too :)

And here I thought that clicking a mouse button to paste must have been one of the greatest mishaps in computer history. I hate that thing with deep passion, I don't want to think about the number of secrets and inconvenience that thing has led to for misclicking in an IRC-window or something like that.

Sorry for the non-constructive comment, I guess it is nice to know that some appreciate it.

The worst thing is when whatever you're pasting has a newline attached, so pasting it also 'presses' return.
I hate that with a passion.
Thats useful for pasting many command lines though.
True, but that's yet another reason as to why a mouse click for paste is a bad idea.
Agreed. It's confusing and unexpected for the vast majority of users.
That in itself isn't a problem, but I hate the feature that Firefox has where middle clicking will navigate to the site in your clipboard if it looks like a URL. I often have links in my clipboard, but I rarely want to navigate to it.
Ubuntu did away with the default behavior to make it "more Mac-like". Although in my experience, the majority of people who want a more Mac-like experience go out and buy a Mac.

I set it back to default behavior on Ubuntu.

https://askubuntu.com/a/1028857

(Another Ubuntu annoyance - in "improving things" by switching from X11 to Wayland, they did away with the Gnome terminal tooltip which shows me how many characters I am resizing my Gnome terminal to. So it is now a rigmarole to set that up each time. Although they seem to turn that on and off at random, some random Ubuntu releases still seem to have it on by default).

X11 -> Wayland.
I still prefer X instead of Wayland. I do not use a desktop environment, and I also think X is a better design (although many of the extensions are not so helpful I think).

(Also, I like the middle mouse cut and paste, too. I still use it in xterm)

For ref, the 3 clipboards in X are:

  xclip -o -selection clipboard # XA_CLIPBOARD

  xclip -o -selection primary # XA_PRIMARY

  xclip -o -selection secondary # XA_SECONDARY
Just install gnome-tweaks then launch it and in the subsection Mouse and Keyboard you will find everything to get back your middle button to copy/paste.

Additionally you can also install the gnome shell extension Mousetweaks to enable gestures with a laptop trackpad.

Is there something emulating this under windows? I love how that clipboard is more fragile: any selection fills it and it doesn't touch my main clipboard.