I have an Apple Mighty Mouse, but it's been banged up a bit. The side buttons (4th buttons) are way too easily pressed. When I'm using Firefox, the 4th button can accidentally click and I'd go back one page, which can be really aggravating. How can I disable the 4th button (on either Firefox or Ubuntu) without getting any new hardware?
Those buttons (forward and back) drive me crazy too! Here's what worked for me:
Open a terminal (CtrlAltT by default), and run:
$ xev | grep -A2 ButtonPress
This will pop open a window. Move the mouse into that window, and press the button(s) that you wish to disable. Look at the third line for each button-press, which will look something like:
ButtonPress event, serial 37, synthetic NO, window 0x4000001, root 0x2f2, subw 0x0, time 355888399, (114,122), root:(114,174), state 0x10, button 8, same_screen YES
Note the number after
button. For me, the back/forward buttons were numbers 8 and 9.
xev window, and create/edit an
.Xmodmap file in your home directory:
$ cat >> ~/.Xmodmap ! Disable buttons 8 and 9 pointer = 1 2 3 4 5 6 7 0 0
In your case, to just disable button 4, you'd want
pointer = 1 2 3 0 5 6 7 8 9.
Press CtrlD to return to the prompt, then test it out:
$ xmodmap ~/.Xmodmap
This will load the
.Xmodmap file and your button(s) should be disabled immediately.
Most desktop environments should load this file automatically next time you log in, making the change permanent.
This is an old question, but I hope this answer helps someone.