» Disable middle mouse pasting (sort of)
Someone asked on IRC how to disable middle mouse pasting in X. Seems like it's a mystery to almost everyone as it's asked on quite a few forums but always left unanswered.
I wouldn't want to miss that feature, personally, but well, here's a trick to disable middle mouse pasting in X:
- list your current mouse pointer X mappings using
xmodmap -pp
(look at the 2nd column) - swap the button 2 with some unused one, typically the highest number
- add a line e.g. "pointer = 1 9 3 4 5 6 7 8 2" (if you have 9 buttons, for the sake of an example) to
~/.Xmodmap
xmodmap -pp |perl -ne 'BEGIN{@a=();$h=0}
{next unless /^\s*\d+\s+\d+\s*$/;
($v)=/^\s*\d+\s+(\d+)\s*$/; push(@a,$v);
if ($v gt $h) {$h=$v}}
END{@b=();foreach(@a){
if ($_ eq "2"){push(@b,$h)} elsif($_ eq $h){push(@b,"2")} else{push(@b,$_)}
}; print "pointer = ".join(" ",@b)."\n";}' >> ~/.Xmodmap