My friend bought yesterday a Logitech M560 mouse (you can see it here) and tried it on her Ubuntu system. It seems to be a relatively new model, so there is no info about it anywhere, except for logitech's own website. The key mapping was off, but I thought it was easy to remap the buttons - I 've been doing it for the past decade with a variety of Logitech mice. However, unlike other mice, where you have to say switch button 13 with button 2, this mouse sends some key press events, as if you had typed on the keyboard.

The mouse has left and right click buttons, a scroll wheel with tilt capability (4 buttons), back and forward buttons on the side, plus a small square button behind the wheel - a total of nine buttons. Pressing the wheel does not function as middle click, there is no switch under it. Instead, pressing the wheel engages and disengages a lock, allowing it to revolve either in steps or freely.

I wanted to get all the "usual" buttons to do what they were supposed to and map the middle click action to the small button behind the wheel, so I started off with xev and xinput to identify which is which:

Button 1 -> left click Button 3 -> right click Button 4 -> wheel up Button 5 -> wheel down Button 8 -> tilt left Button 9 -> tilt right

And here's the weird part: Pressing the forward button is like pressing Super_R (keycode 134). Pressing the back button yields simultaneously Super_L and d (keycodes 133 & 40).

Even more weirdness: Pressing the square button once, gives simultaneously Alt_L, Super_L and XF86TouchpadOff (keycodes 64, 133, 201). Pressing it a second time is like pressing button 1...

So, the first six buttons send button press/release events, while the other three send multiple key press/release events.

It is relatively easy to map a mouse button to a keyboard keycode, but is it possible to do the opposite, without crippling the system's keyboard? Should I contact someone from kernel.org to add support for the mouse?

  • I seem to recall these mice might remember their settings, so I wonder if its a pre-existing keymap
    – Journeyman Geek
    Nov 15, 2013 at 12:08
  • According to the manual of that Mouse, it is specifically designed to do these operations on Windows 8. F.e. what you call the "forward" button (as on the M500) is labeled in the manual "show the Windows 8 desktop". So I'm pretty sure that the mouse is actually sending these events and is specifically designed to please Windows 8. The manual also mentions that for Windows 7 special software is required for it to work, so go figure.
    – Bobby
    Nov 15, 2013 at 12:12
  • @journeyman-geek I thought the keymap is derived from the kernel/evdev driver plus any particular X server settings.
    – xander.pl
    Nov 15, 2013 at 12:33
  • @bobby I saw that the square button is supposed to open some drawers if that's what they're called in win 8, but the keycodes don't seem to match a relevant keyboard shortcut. Logitech develops the SetPoint software, which allows you to map your keys however you like and for different applications, but that is solely a windows thing.
    – xander.pl
    Nov 15, 2013 at 12:34
  • not necessarily, lots of modern mice actually store keymaps on on board memory.
    – Journeyman Geek
    Nov 15, 2013 at 13:22

5 Answers 5


You can remap the keys via udev. The mouse acts as a keyboard. There is a work around here: https://bugzilla.redhat.com/show_bug.cgi?id=1035668

  • Thanks for the workaround, however it didn't work in my case. I have Logitech M560 and Logitech K750R connected through a single unifying receiver. When I apply the workaround, some modifier keys and letter 'd' stop working on the keyboard, while the extra mouse buttons don't work either. Could that be caused by the fact that they use a single unifying receiver? Thanks! Dec 22, 2013 at 7:48
  • Yes. The work around currently remaps keyboard calls to the unified receiver. Meaning you can't use the M560 & another Logitech wireless Keyboard. Dec 24, 2013 at 16:02
  • Thanks for your reply, Jerone! Are you aware of any other potential solution that could address this issue? Dec 27, 2013 at 2:21

this is my configuration:

~$ cat .xbindkeysrc |egrep -v "^$|^#"
"xte 'mouseclick 2'"
    m:0x50 + c:134

In this way if made "work" the middle button.

I choose the text I need to copy/paste while holding the right button, after choosing where to paste I click button. If need to paste again the same text, since the square button doesn't raise the same events every time, I'll click it quickly twice.

If you select another text the event scattered from the square button is always the one that makes xte to emulate the middle click.

Is not perfect but better than not having middle click at all.


I'm sorry to be That Guy, but please bear with me. I've been using Logitech mice and pointing devices on a number of machines, Windows, Linux and both, without issues. Even the T650 touchpad, which was advertised as being a Windows 8 device, worked properly in Linux with a firmware update. The M560 simply can't be made to work 100% correctly in anything but Windows without some rather excessive hacks. You may be able to swap with someone else for an older/working model, or you might be able to get a refund since it's not at all clear from the packaging that the mouse isn't compatible with anything but Windows, but I really wouldn't recommend spending much time on it.

I personally exiled my M560 to an HTPC that doesn't get a lot of mouse usage.


On Ubuntu 20.10 all buttons work properly but the ones on the thumb (forward/back). These buttons are detected as buttons 10 and 11. Adding this to .xbindkeysrc makes them work as forward/back buttons:

"xte 'keydown Alt_L' 'key Right' 'keyup Alt_L'"

"xte 'keydown Alt_L' 'key Left' 'keyup Alt_L'"

You can check it works by running xbindkeys from a terminal. Then add it to some place so it's run automatically on session start.


It's 2018, with my KDE Fedora 25, kernel 4.13.16-100.fc25.x86_64 and the M560 middle square button works out of the box as a normal middle button (button 2).

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .