How to disable Middle-Mouse-wheel Click to Paste (XFCE)

Message
Author
User avatar
remoteone
Posts: 48
Joined: Sat Jul 20, 2019 9:04 am

Re: How to disable Middle-Mouse-wheel Click to Paste (XFCE)

#11 Post by remoteone »

Thank you for the assistance. I
At this stage, I should point out my opinion that the middle-wheel click-to-paste function can be an asset and a liability.
An asset when you actually WANT to just paste to an input box... but a DISASTER to productivity when accidental clicks occur.
Thus, an OS-wide solution isn't really the best solution. Since discovering that FireFox and Thunderbird have the setting to disable this, surely its technically possible for this to be disabled at app level, if the authors would implement.
At the risk of getting a bit off-topic...
What I really need now is a good code editor that also has this "disable-middle-click-paste" preference... alas, Geany and Bluefish dont seem to have this ability.

Code: Select all

 xinput --list
⎡ Virtual core pointer                    	id=2	[master pointer  (3)]
⎜   ↳ Virtual core XTEST pointer              	id=4	[slave  pointer  (2)]
⎜   ↳ Logitech G304                           	id=11	[slave  pointer  (2)]
⎜   ↳ DLL07BF:01 06CB:7A13 Mouse              	id=13	[slave  pointer  (2)]
⎜   ↳ DLL07BF:01 06CB:7A13 Touchpad           	id=14	[slave  pointer  (2)]

Code: Select all

xinput --list 11 | egrep 'Buttons? '
Buttons supported: 24
Button labels: "Button Left" "Button Middle" "Button Right" "Button Wheel Up" "Button Wheel Down" "Button Horiz Wheel Left" "Button Horiz Wheel Right" "Button Side" "Button Extra" "Button Forward" "Button Back" "Button Task" "Button Unknown" "Button Unknown" "Button Unknown" "Button Unknown" "Button Unknown" "Button Unknown" "Button Unknown" "Button Unknown" "Button Unknown" "Button Unknown" "Button Unknown" "Button Unknown"
		Button state:

User avatar
remoteone
Posts: 48
Joined: Sat Jul 20, 2019 9:04 am

Re: How to disable Middle-Mouse-wheel Click to Paste (XFCE)

#12 Post by remoteone »

I found that there is an atom-disable-middle-click-paste extension for the Atom editor.

User avatar
fehlix
Developer
Posts: 12740
Joined: Wed Apr 11, 2018 5:09 pm

Re: How to disable Middle-Mouse-wheel Click to Paste (XFCE)

#13 Post by fehlix »

remoteone wrote: Fri Nov 13, 2020 7:11 pm

Code: Select all

 xinput --list
⎡ Virtual core pointer                    	id=2	[master pointer  (3)]
⎜   ↳ Logitech G304                           	id=11	[slave  pointer  (2)]

Code: Select all

xinput --list 11 | egrep 'Buttons? '
Buttons supported: 24
Button labels: "Button Left" "Button Middle" "Button Right" "Button Wheel Up" "Button Wheel Down" "Button Horiz Wheel Left" "Button Horiz Wheel Right" "Button Side" "Button Extra" "Button Forward" "Button Back" "Button Task" "Button Unknown" "Button Unknown" "Button Unknown" "Button Unknown" "Button Unknown" "Button Unknown" "Button Unknown" "Button Unknown" "Button Unknown" "Button Unknown" "Button Unknown" "Button Unknown"
		Button state:
OK, a bash one liner:
To switch middle click off: ( SWITCH=0 ):

Code: Select all

bash -c 'SWITCH=0; M="Logitech G304"; MID=$(xinput --list --short | grep -oP "$M.*id=\K\d+"); BN=$(xinput --list $MID | grep -oP "Buttons supported: \K\d+"); P="xinput set-button-map  $MID $(for i in $(eval echo {1..$BN}); do ((i==2)) && ((SWITCH==0)) && echo 0 || echo $i; done)"; echo $P; $P'

To switch middle click on: ( SWITCH=1 ):

Code: Select all

bash -c 'SWITCH=1; M="Logitech G304"; MID=$(xinput --list --short | grep -oP "$M.*id=\K\d+"); BN=$(xinput --list $MID | grep -oP "Buttons supported: \K\d+"); P="xinput set-button-map  $MID $(for i in $(eval echo {1..$BN}); do ((i==2)) && ((SWITCH==0)) && echo 0 || echo $i; done)"; echo $P; $P'
You can bind it to keyboard shortcuts for enabling or disabling.
HTH
:puppy:
EDIT: adjusted to a slightly shorter variant

User avatar
i_ri
Posts: 1106
Joined: Tue Jun 30, 2015 12:26 am

Re: How to disable Middle-Mouse-wheel Click to Paste (XFCE)

#14 Post by i_ri »

Hello remoteone
Sympathetic tone, touchpad did it to me last week.
Scrolling to make some changes in a config file
the touchpad must have taken some of the scrolls as paste (suspected middle-click).
scrolling quickly I missed seeing it happen; ensuing error to pursue.
never had a problem with mousewheel.
This certain touchpad is the first culprit to paste on middle-click unexpectedly.

User avatar
JayM
Posts: 6796
Joined: Tue Jan 08, 2019 3:47 am

Re: How to disable Middle-Mouse-wheel Click to Paste (XFCE)

#15 Post by JayM »

The thing with many text editors and IDEs is that they're QT apps so the Gnome Tweak Tools mouse settings has no effect on them, but supposedly Geany is GTK-based so it should respect your GTK (Gnome) settings. Otherwise do as fehlix suggested to globally disable middle button click-to-paste everywhere on your system. Or just continue using Atom editor if you prefer, in which case please edit your post #1 and add "[SOLVED]" to the subject.
Please read the Forum Rules, How To Ask For Help, How to Break Your System and Don't Break Debian. Always include your full Quick System Info (QSI) with each and every new help request.

User avatar
remoteone
Posts: 48
Joined: Sat Jul 20, 2019 9:04 am

Re: How to disable Middle-Mouse-wheel Click to Paste (XFCE)

#16 Post by remoteone »

So the bigger issue turns out to be the default linux "feature" referred to as copy-selection-to-clipboard.
This should be disabled by un-checking Clipman's [Sync selections] . But changing this has no effect at all.

Is there a Property that can be added to Settings Editor (or other) > xfce4 > plugins > ... to turn off copy-selection-to-clipboard

This so-called feature is an annoying hangover for when linux was all command line. Great for Terminal, but a productivity killer and security risk for desktop apps.
New topic needed for this no doubt.

Huckleberry Finn

Re: How to disable Middle-Mouse-wheel Click to Paste (XFCE)

#17 Post by Huckleberry Finn »

Maybe doing the reverse of this works: ( Option "Emulate3Buttons" "off" )

Edit: It seems you already solved that, anyway, Radivarig's suggestion here seems to have worked for many people - also referenced from other sites - .

User avatar
fehlix
Developer
Posts: 12740
Joined: Wed Apr 11, 2018 5:09 pm

Re: How to disable Middle-Mouse-wheel Click to Paste (XFCE)

#18 Post by fehlix »

Toggle Middle Click Desktop Icon

I've seen different proposals. Here my latest.
toggle-middle-click.desktop

Code: Select all

[Desktop Entry]
# filename: toggle-middle-click.desktop
# MX-Forum: https://forum.mxlinux.org/viewtopic.php?p=609993#p609993
# fehlix , 26.11.2020
Version=1.0
Type=Application
Name=Toggle Middle Click
Comment=Switch middle click on/off
Exec=bash -c 'P=($(xmodmap -pp|grep -oP '[0-9]+$'));S=${P[1]};P[1]=${P[-1]};P[-1]=$S; MM="pointer = ${P[*]}"; X="xmodmap -e \\"$MM\\""; echo $X; XM=~/.Xmodmap; touch $XM; sed -i "/^[[:space:]]*pointer[[:space:]]*=/d" $XM ; echo  $MM >> $XM;  eval $X; STATE=OFF; ((P[1]==2)) && STATE=ON; notify-send  --icon=input-mouse "Middle Click $STATE"'
#Icon=input-mouse-wheel
Icon=input-mouse
Path=
Terminal=false
StartupNotify=false
Categories=XFCE;GTK;Settings;DesktopSettings;X-XFCE-SettingsDialog;X-XFCE-HardwareSettings;
Copy and paste the content into a new text file and name it "toggle-middle-click.desktop".
Clicking on the desktop icon will switch on/off the mouse middle click.
It stays sticky after reboot or logout and login.
You can also copy the desktop-file into the folder ~/.local/share/applications
so it will be available within the menu.
HTH
:puppy:

User avatar
remoteone
Posts: 48
Joined: Sat Jul 20, 2019 9:04 am

[Solved] How to disable Middle-Mouse-wheel Click to Paste (XFCE)

#19 Post by remoteone »

I have found my problem.. something to watch out for with linux (or maybe just xfce.. dunno)
So.. the issue really is that all text selected by double-click was being copied to Clipman manager list, even though Sync-selection setting of Clipman was unchecked.
Turns out that the title for this post should be different. 9_9

I had tried out a number of clipboards out, installed and then uninstalled properly via MX installer.
However there were ~/.conf/clipit?? and .../copyq and ~/.config/autostart/ config files left behind. Deleted these and logged back in, problem fixed.
The Clipman setting was being overridden by config files left behind.
I was alerted to this by a post somewhere about tigerVNC doing the save damage (damage to my freaking brain).
Clipman issue is solved. :happy:
And any app (Terminal, Geany etc) that does not have its own setting for this will still Middle-Mouse-wheel Click to Paste ... still works the old unix way with auto copy-selection and middle-wheel-paste.

User avatar
JayM
Posts: 6796
Joined: Tue Jan 08, 2019 3:47 am

Re: How to disable Middle-Mouse-wheel Click to Paste (XFCE)

#20 Post by JayM »

If this is solved to your satisfaction, could you please edit your original post #1 at the very top of the topic by clicking the pencil tip icon, the one circled in red in my screenshot image below (yours won't have the red circle)
Image
and add [SOLVED] at the front of the subject? This will make it easier for others when they search the forum looking for a solution to the same problem. Thanks.
Please read the Forum Rules, How To Ask For Help, How to Break Your System and Don't Break Debian. Always include your full Quick System Info (QSI) with each and every new help request.

Post Reply

Return to “Software / Configuration”