Simple way to disable mouse middle click paste in linux?

You can talk about almost anything that you want to on this board.

Moderator: Moderators

Post Reply
User avatar
Banshaku
Posts: 2417
Joined: Tue Jun 24, 2008 8:38 pm
Location: Japan
Contact:

Simple way to disable mouse middle click paste in linux?

Post by Banshaku »

I did search on the subject in the past but in all thing linux, you find either too many answer and are not sure which one is appropriate (is it in X? is it something in the desktop manager? etc) or someone that will say something like "that's how it's supposed to work so why are you complaining about that?" kind of answer ^^;;;

I don't hate the feature, it just that I don't know how many time I just use the scroll wheel and all of a sudden, it just paste something in your current windows and causes havoc in it. One error I had was because some paste that didn't cause the code to fail and it just compiled properly and found later after scratching my head as to why some behavior changed.

I will search again soon on the subject but is there someone that disabled it because they didn't like it? Right now I'm using xfce but there is no option to disable it from the UI or I don't think I will find it since it's "normal".
tepples
Posts: 22708
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Re: Simple way to disable mouse middle click paste in linux?

Post by tepples »

You guessed right: It is traditional for X11 applications to paste the primary selection when you press the middle mouse button in a text input control. The primary selection is the most recently selected text. It is distinct from the clipboard, which is what the Cut, Copy, and Paste commands access.

Have you tried Google Search for disable middle click paste? It lists an article on Make Tech Easier and answers by users of Ask Ubuntu. One solution uses xmodmap to disable all middle-click behavior, including opening links in new tabs. Another involves installing the xsel app and telling it to continuously erase the primary selection. Another works only in Firefox: in about:config set middlemouse.paste to false.
User avatar
Banshaku
Posts: 2417
Joined: Tue Jun 24, 2008 8:38 pm
Location: Japan
Contact:

Re: Simple way to disable mouse middle click paste in linux?

Post by Banshaku »

I think that I must have ended on those pages when I searched with some similar terms. It just that when you have one solution that explain how to "erase the buffer" non stop, editing GTK source code to "fix" the issue etc, I didn't think there was a clear answer and just left it on hold "until I get too annoyed by it" state :lol:

I think I should just go with disabling middle click and that's it since I really don't use it much anyway. The thing is, I don't press the scroll wheel button: just scrolling activate randomly the press event, which means either the sensibility is too high or the mouse is getting older and some click are triggered, somehow.

I will check more about xmodmap then. I don't remember why I didn't go with it, maybe I had issue with it. I will try it again and see how it goes.

Thanks!

edit:

xmodmap seems to do the job since the middle button is now deactivated. I will check on next reboot if ~/.Xmodmap config is reloaded properly.
User avatar
slembcke
Posts: 172
Joined: Fri Nov 24, 2017 2:40 pm
Location: Minnesota

Re: Simple way to disable mouse middle click paste in linux?

Post by slembcke »

Hmm. Yeah AFAIK it's an application level feature that most X11 apps implement independently like Tepples said, so I don't think there is really a way to disable it globally. There is a setting to disable it in the gnome tweaks tool for all GTK based apps (which is most of what I have on my machine anyway).

Image
lidnariq
Posts: 11432
Joined: Sun Apr 13, 2008 11:12 am

Re: Simple way to disable mouse middle click paste in linux?

Post by lidnariq »

Off topic: when I first started using X11, the middle click paste was one of my favorite features. It's surreal encountering someone of the opposite opinion.

Older login managers did source one's $HOME/.xmodmap on login, but I wouldn't trust GNOME to not break that.
User avatar
Banshaku
Posts: 2417
Joined: Tue Jun 24, 2008 8:38 pm
Location: Japan
Contact:

Re: Simple way to disable mouse middle click paste in linux?

Post by Banshaku »

@slembcke

I'm not using gnome at the moment so I cannot use that panel and since it's specific to GTK it may not disable for some of the app I use so I went with the extreme way: just disable it :P

@lidnariq

Like I mentioned, it's not that I "hate" the feature per say, it can be useful, but when just scrolling, no button press at all, causes the mouse to paste random text in the active view... That gets quite annoying after a while :lol:

So for the time being, for that specific computer which uses a mouse that it still working but seems too sensitive (maybe it's something with bluetooth or something else, who knows), it is better to just disable the feature than cursing every time you find a new place that text was pasted by accident.
zzo38
Posts: 1096
Joined: Mon Feb 07, 2011 12:46 pm

Re: Simple way to disable mouse middle click paste in linux?

Post by zzo38 »

I am the opposite. I use the middle click paste, but I do not use the scroll wheel (so I have disabled the scroll wheel in .Xmodmap instead). (I would rather use a mouse without a scroll wheel, but I do not have one.)
(Free Hero Mesh - FOSS puzzle game engine)
User avatar
Banshaku
Posts: 2417
Joined: Tue Jun 24, 2008 8:38 pm
Location: Japan
Contact:

Re: Simple way to disable mouse middle click paste in linux?

Post by Banshaku »

The last time I used a mouse without scroll wheel must have been in 97. It was a Logitech 3 buttons type and when scroll wheel became more common, I wasn't too fond of them.

Now I'm used but I guess it is just because it is very hard to find one without a wheel these days. Scroll wheel are a boon for joint pain, I guess :lol:
Hangin10
Posts: 37
Joined: Thu Jun 04, 2009 9:07 am

Re: Simple way to disable mouse middle click paste in linux?

Post by Hangin10 »

I didn't even know this was a thing. I've sometimes missed clicking the bookmarks toolbar in Firefox and ended up middle-click-pasting the same url into the middle of itself in the address bar. Not a clue what was happening (other than maybe Firefox constantly putting the url in the clipboard or something).

Having just tried it in gedit, now I can copy/paste without having to use the keyboard. It also doesn't appear to move the cursor. I'm not certain, but this might help increase coding speed now that I know what's going on. Thank you.
User avatar
Banshaku
Posts: 2417
Joined: Tue Jun 24, 2008 8:38 pm
Location: Japan
Contact:

Re: Simple way to disable mouse middle click paste in linux?

Post by Banshaku »

Glad to see that this topic somehow helped someone improve their productivity :lol:
User avatar
slembcke
Posts: 172
Joined: Fri Nov 24, 2017 2:40 pm
Location: Minnesota

Re: Simple way to disable mouse middle click paste in linux?

Post by slembcke »

Banshaku wrote:The last time I used a mouse without scroll wheel must have been in 97. It was a Logitech 3 buttons type and when scroll wheel became more common, I wasn't too fond of them.

Now I'm used but I guess it is just because it is very hard to find one without a wheel these days. Scroll wheel are a boon for joint pain, I guess :lol:
I've had a Kensignton Turbo Mouse trackball for like 10+ years. Best trackball you can buy for wrist issues IMO, but every couple years I have to dismantle it and clean out the optical scroll ring sensor. I've been lazy and just stopped using the scroll ring for at least two years now. Hehe.
Post Reply