Ralf Öchsner

Logitech Performance Mouse MX on Linux

This short tutorial shows how to make every button of the Logitech Performance Mouse MX work on Linux. I have only tested it on Ubuntu Linux (all Desktop Versions from 12.04 to 15.10) so far, but it should work as well on all other modern Linux distributions. Basically the mouse works just fine out of the box but there are some things that need a little bit of tuning to make all the features work as expected (e.g. as on Windows).

Update 2015-07-30: Apparently some users want to get the zoom button + wheel to zoom, not just toggling the control. Camilo Rada kindly shared his solution for that.

Update 2016-03-17: I recently upgraded and bought the Performance MX's successor the Logitech MX Master. Check the new page for more information!

What works out of the box

When you connect the USB receiver the mouse is detected by X11 and the following features already work:
  • normal pointer operation
  • left, right and middle mouse button
  • back and forward button (for example in Firefox)
  • hyper-fast scrolling (the button is mechanical so no software support required)
  • side scrolling
  • USB charging and operation via USB cable (actually the cable doesn't replace the wireless connection, it only charges it)

What doesn't work

  • the big thumb button
  • the zoom button

Making it work and customization

Thumb button

On Windows the big thumb button shows all opened application windows when you have the Logitech mouse software installed. This behaviour is very similar to the Initiate Window Picker For All Windows function of Compiz/Unity/Gnome. In my opinion the Compiz function works even better and faster than the one of the Logitech Windows software. The mouse button can be comfortably assigned to this function with the CompizConfig Settings Manager. If not already done it can be installed via Synaptics or apt-get on Ubuntu:
sudo apt-get install compizconfig-settings-manager
Then open the CompizConfig settings manager (ccsm) and click on the "Scale" plugin: Then go to the Bindings tab and select Initiate Window Picker For All Windows with the mouse symbol in front of it and assign the function to Button 10 (which is the thumb button): With this setting the button needs to be pressed to show you all opened windows. When you release the button it will be automatically switched to the window that lies under the cursor. If you like that behaviour you can of course leave it like that. However on Windows the button just toggles the function so that the button doesn't need to be pressed all the time. To get that very same behaviour just check the radio button which says Button Bindings Toggle Scale Mode (cp. screenshot).

Zoom button

Toggling zoom

With the Windows software the zoom button enables a zoom mode where the mouse wheel can be used for zooming until the zoom button is pressed again. For most applications this is the same behaviour as holding down the control button on your keyboard and using the mouse wheel in the meantime. So my approach is to turn the zoom mouse button into button that toggles the control button. This works very well for most use cases. To accomplish that xbindkeys and xautomation can be used:
sudo apt-get install xbindkeys xautomation
Then create the file .xbindkeysrc with the following content in your home folder:
"/usr/bin/xte 'keydown Control_L' &"
"/usr/bin/xte 'keyup Control_L' &"
Control + b:13
The configuration can be tested with:
xbindkeys -n -v
Xbindkeys has to be started after every login to work permanently. On Ubuntu you can add a Startup Application in the menu on the upper right to do that. With xbindkeys you can also do all kinds other customizations. Feel free to experiment with it!

Zoom button pressed + wheel

Apparently some users want to get the zoom button + wheel to zoom, not just toggling the control. Camilo Rada kindly mailed me his configuration file for xbindkeys that allows to zoom with the wheel when the zoom button is pressed and also allows to assign a command to the press-and-release action of the zoom button.

The configuration file has to be placed in your home folder with the name .xbindkeysrc.scm and the following content:

;;   This configuration is guile based.
;;   http://www.gnu.org/software/guile/guile.html
;;   This config script is supposed to live in the homedirectory and be named .xbindkeysrc.scm
;;   Based on the script by Zero Angel posted at
;;   http://www.linuxquestions.org/questions/linux-desktop-74/%5Bxbindkeys%5D-advanced-mouse-binds-4175428297/
;;   And adapted by Camilo Rada
;;   It is intended to work with the Logitech Performance MX Mouse
;;   It allows to zoom with the wheel while the zoom button is pressed
;;   It also allows to assing an action to a single press-and-release of the zoom button
;;   The action assigned to that action is Super+z but is can be modified

(define actionperformed 0)

(define (first-binding)
"First binding"
;; Logitech Zoom Button
(xbindkey-function '("b:13") b13-second-binding)

(define (reset-first-binding)
"reset first binding"
;; Set Action Performed state back to 0
(set! actionperformed 0)
;; Forcefully release all modifier keys!
(run-command "/usr/bin/xte 'keyup Control_L' 'keyup Alt_L' 'keyup Shift_L' 'keyup Super_L' &")


(define (b13-second-binding)
"Zoom Button Extra Functions"

;; Scroll Up
(xbindkey-function '("b:4")
                (lambda ()
;; Emulate Ctrl+plus (Zoom in)
                (run-command "/usr/bin/xte 'keydown Control_L' 'key plus' 'keyup Control_L' &")
        (set! actionperformed 1)

;; Scroll Down
(xbindkey-function '("b:5")
                (lambda ()
;; Emulate Ctrl+Alt+minus (Workspace Down)
                (run-command "/usr/bin/xte 'keydown Control_L' 'key minus' 'keyup Control_L' &")
        (set! actionperformed 1)

(xbindkey-function '(release "b:13") (lambda ()
;; Perform Action if Button 8 is pressed and released by itself
(if (= actionperformed 0) (run-command "/usr/bin/xte 'keydown Super_L' 'key z' 'keyup Super_L' &"))

;; (debug)

; End of xbindkeys configuration ;

The programs xbindkeys and xautomation both have to be installed as described in Toggling zoom. Special thanks go to Camilo Rada for sharing his solution.