Get the Apple MagicMouse ‘back’ feature with a Logitech M305 mouse and Ubuntu or Linux Mint

I hated my MacBook when I tried one earlier this year. I gave it 6 months near enough, but I couldn’t get used to the erratic minimise’ behaviour of the Dock, the US keyboard layout, the bloody cost of any decent apps or accessories, and actually I was pretty disappointed by the standard of the built-in apps like Numbers. After that trial period I sold the MacBook, bought a Dell M3800 and learned just what fun it can be to try to install Linux on EFI bootloaders :wink:

But one thing I really liked & missed from the MacBook was the swipe Back and Forward browsing feature of the Magic Mouse.

I decided to see if I could get the ‘left’ and ‘right’ switches on the mouse wheel of my Logitech M305 wireless mouse to do the same thing.

Turns out it’s not hard, I thought I’d write it down here as there didn’t seem to be any complete and basic guide out there yet, and also I might forget one day so it’s here as a ‘message in a bottle to future self’ (thanks to James Edward Gray of the @RubyRogues podcast for introducing me to this concept!)

This guide on Ubuntu Forums was my main source, but the was a bit weirdly laid out and the imwheelrc entry wasn’t quite right for me, so I thought it would be worth doing a quick blog post about it.

Install imwheel

sudo apt-get install imwheel

Edit /etc/X11/imwheel/imwheelrc in your text editor du jour , inserting the below snippet:

#firefox Back and Forward mapped to mouse wheel Left and Right<br />
"^Firefox$"<br />
None,Left,Alt_L|Left<br />
None,Right,Alt_L|Right<br />

I think I then needed to start imwheel manually (type imwheel in a terminal window) to test it was working

It worked almost suspiciously well, making me wonder what it’s broken…. But so far nothing’s borked. Tested on Mint 17 Qiana with M305 mouse, but should work pretty identically on any Ubuntu variant, and quite similarly on non-Ubuntu Linuces (plural of Linux surely). And should also work just as well with any mouse that has mouse wheel left and right switches.

And I put an entry in Startup Applications so it should start automatically when the machine boots up. This also seems to work.

Update February 2016:

I switched to Google Chrome after 10 years of using Firefox, as recent updates (FF43-45 on Linux) have been REALLY slow. The imwheel hack also works on Chrome:

#chrome Back and Forward mapped to mouse wheel Left and Right
"^google-chrome$"
None,Left,Alt_L|Left
None,Right,Alt_L|Right

And perhaps unsurprisingly, it also works with the Logitech MX Anywhere and Anywhere 2 Mice…