Mouse Logitech MX Anywhere 2s Flounder on Linux

1 minute read

Logitech Mx Anywhere 2s Flounder on Linux


I bought a Logitech Mx Anywhere 2s Flounder mouse too free up a USB port, and be able to configure more buttons compared to the mouse I had.

When you connect it on Linux, the mouse works the first time without doing any magic. The two buttons on the right side of the mouse are configured for Forward and Back in the browser and any application in general.

For Windows and for Mac there’s a mouse software that allows you to customize these buttons (with gesture support as well), but for Linux that software is not available.

If you want to map these buttons in Linux you should use something like xbindkeys or xmodmap. Here I explain what I had to do to get it working the way I wanted.

1. Install the necessary software

You will need xbindkeys for maping the keys, and xdotool to execute keyboard actions.

apt install xbindkeys xdotool

2. Detecting the button keys

You can find out what keys are associated to your mouse using xev:

xev | grep button

This will open a small white window which is where you should place the mouse pointer and press the buttons to obtain the values associated with each key:

xev


I tried all the buttons and their corresponding values are shown above, in the first image of this post above. In total there are 9 possible buttons / keys.

3. Buttons mapping

You need to create a file for xbindkeys with the default options, which in fact is a file with some commented examples:

xbindkeys --defaults > ~/.xbindkeysrc

And then add the mapping you want. In my case I added the following in the ~/.xbindkeysrc:

"guake"
  b:9

"xdotool key Super_L"
  b:8

Finally you must run the command xbindkeys:

$ xbindkeys

Now pressing button 9 (Forward) will run Guake, while if I press button 8 (Back) it strokes the Super_L key (Start key or also badly known as the Windows key).

References

Leave a Comment