Scientific Linux Forum.org



  Reply to this topicStart new topicStart Poll

> Disable or change middle mouse button default Paste-command, Disable or change middle mouse button de
sokhan
 Posted: Aug 31 2011, 11:13 AM
Quote Post


SLF Newbie


Group: Members
Posts: 1
Member No.: 791
Joined: 31-August 11









Hi!

I was wondering if it is possible to remove/change Scientific Linux middle button behavour, default is Paste-command? I cannot seem to find any options for it in the "System"-->"Preferences"-->"Mouse". It's very annoying that middle button is the Paste-command or that I am not used to it...

Thanks.
PM
^
helikaon
 Posted: Aug 31 2011, 11:33 PM
Quote Post


SLF Moderator
******

Group: Moderators
Posts: 586
Member No.: 4
Joined: 8-April 11









Hi,
this Q may seam to be trivial easy at first, but not as much, actually interesting Q.....

This is feature of X server. This means it comes from Unix prehistroric times, so every true linux geek *must* love it (and actually i do and i miss this feature in other OSes (no names pls) smile.gif .
There is no easy way (as far as i know) to get rid of this pasting 'feature' from KDE, Gnome, etc ...

This being said, we need to look on the X server settings - particularly on the button and keys mapping.
your answer is:
CODE

man xmodmap


list current mappings of mouse:
CODE

xmodmap -pp


and of keyboard:
CODE

xmodmap -pk
xmodmap -pke


you see, every keybord key has code 1->255 and you can via 'xmodmap' command tell to X server to remap it. Same as you can remap pointer buttons (in my case pointer buttons have only 1->9 mappable positions).

e.g. on my laptop (here please note, that i'm left handed, so i use left-handed mouse, so my 1 and 3 buttons are 'switched':
CODE

$ xmodmap -pp
There are 9 pointer buttons defined.

   Physical        Button
    Button          Code
       1              3
       2              2
       3              1
       4              4
       5              5
       6              6
       7              7
       8              8
       9              9

So i can see, if i set up my 2nd button to some unmappable number, it will do nothing:

xmodmap -e "pointer = 1 20 3"

This way my second button was mapped to '20' and will do nothing.


To make it permanent OS wide create (as root):
CODE

vi /etc/X11/Xmodmap
put in:
pointer = 1 20 3
:wq (save & quit)


To make it per user basis (to override OS wide setting, or if OS wide setting is not present):
CODE

cd ~
vi .Xmodmap
put in:
pointer = 1 20 3
:wq (save & quit)


done

cheers,

This post has been edited by helikaon: Aug 31 2011, 11:38 PM


--------------------
PMEmail Poster
^
swirlythingy
 Posted: Feb 19 2012, 08:04 PM
Quote Post


SLF Rookie
*

Group: Members
Posts: 20
Member No.: 961
Joined: 23-October 11









QUOTE (sokhan @ Aug 31 2011, 11:13 AM)
Hi!

I was wondering if it is possible to remove/change Scientific Linux middle button behavour, default is Paste-command? I cannot seem to find any options for it in the "System"-->"Preferences"-->"Mouse". It's very annoying that middle button is the Paste-command or that I am not used to it...

Unfortunately, helikaon's answer will cause your middle button to stop working altogether, including using it in Firefox to open windows in new tabs, and in the file browser to close the parent window. Effectively, this is totally useless, and it's the only solution everyone seems to post in response to this exact question on every forum I've searched, frequently even if the original poster includes a condition that they do not want to disable the middle button! (That's when they don't just say, "There is absolutely no reason why anyone would want to do this thing you have just expressed a desire to do and because I've never accidentally middle-clicked it must therefore mean that everybody in the world never accidentally middle-clicks and we will never do anything about it so shut up and so there!")

The unfortunate truth is that there is absolutely no way to disable this whatsoever, thanks to the anal-retentiveness of a certain kind of Linux developer, in which the mounting opposition to a deeply divisive feature is seen as a threat to their sovereignty. Such is the depth of contempt in the 'pro middle click paste' camp towards the anti camp, they have spent the best part of a decade refusing even to make the behaviour configurable. It remains compulsory for everyone, and (as you can probably tell) both this fact and the circumstances and attitudes leading up to it really piss me off.

(Disclaimer: I'm not in any way an expert on Linux history or community, but I've been doing some serious Googling trying to find a solution to this problem, and I found one or two posts in particular - written by developers - which made me want to strangle the authors.)

However, I have managed (with great difficulty) to find out how to disable it in two of the biggest offenders - Firefox and Emacs. These two fixes won't solve the problem, but they paper over a fairly substantial proportion of it, so I'm adding it to this thread for the future reference of everyone.

To solve for Firefox:

Open a blank tab, and in the URL bar, type "about:config". Ignore the silly message about voiding your warranty (...what warranty?) and locate the two options "middlemouse.contentLoadURL" and "middlemouse.paste". Set both to false. (Keep the other two "middlemouse" options true, unless you don't like being able to open links in new tabs.)

To solve for Emacs:

Open the file "~/.emacs", and insert the following line:

(global-unset-key (kbd "<mouse-2>"))

Note that, if anything else binds something to the middle button locally, that will still work - it's only the default "mouse-yank-at-click" which'll be killed off. (I hope...)
PMEmail Poster
^
0 User(s) are reading this topic (0 Guests and 0 Anonymous Users)
0 Members:

Topic Options Reply to this topicStart new topicStart Poll