I had a vague memory that Logitech mice could be Linux friendly (don't know though) and found this:
when searching for logitech + linux
Obviously an applet to achieve what you ask for.
If you have a Logitech why not test it?
I've got a three button one so it's not for me