Smooth scrolling with greatest trackball MX Ergo

With no doubt, MX Ergo is one of the greatest trackball in the market right now.

Before it, I used Logitech M570 Wireless trackball mouse then I hear about MX Ergo. I’ve been waiting for this device for well over a decade – a Bluetooth version of Logitech’s fabled TrackMan Marble Wheel. And this is, indeed, a really nice trackball for use with new laptops that don’t have USB-A ports, such as the MacBook/MacBook Pro.

Logitech MX Ergo Wireless Trackball Mouse
Logitech MX Ergo Wireless Trackball Mouse

The trackball functionality is exactly as you’d expect if you used the M570, with a few extra features – tiltable scrollwheel, the ‘precision’ button to allow fine control, and the ability to switch between two devices. The AA battery has been replaced by li-poly and recharges via micro-USB.
A unique adjustable hinge allows you to choose the best angle between 0°and 20° for a more natural hand position and greater comfort.

MX Ergo is working on Linux/Windows flawlessly

This mous is working well on Windows of course.

I’m using it with Arch Linux daily, and everything works pretty much as expected. I’m using the Unifying Receiver on a Dell mornitor that connected with my Mac Book and Bluetooth on a Arch Linux laptop with Wayland. Everything works on the laptop, and everything but horizontal scrolling  isn’t working on the Mac Book (I solved it below). I’m not sure if the difference is MacOS versus Arch Linux or Unifying Receiver versus Bluetooth.

MX Ergo horiontal scrolling problem on Mac Book

But, switching to MX Ergo, especially from Macbook’s trackpad or Magic Mouse, and people around you will soon hear you complain about the stupid scrolling of the trackball.

Apparently it’s not too bad, but unliked M570, MX Ergo lack of smooth scrolling, horizontal scrolling will affects your workflow a lot. For example, if you need to work with design tools like Figma or Sketch regularly.

I’ve had that problem too, until when I discovered an awesome script from u/Jitowix on Reddit.

So, there are two options:

  1. Use a non-free application called Smooze to get the problem solved.
  2. Or be a geek and spend sometimes setting up some script to solve the problem.

I choose option 2, it’s not too hard by the way, follow these two steps and you’ll have smooth scrolling on your trackball by holding Right Mouse button while scroll your ball.

  1. Install Hammerspoon via Homebrew:
    brew cask install hammerspoon
  2. Open ~/.hammerspoon/init.lua and type in this script:
local scrollMouseButton = 2
local deferred = false

overrideOtherMouseDown =
    deferred = true
    return true

overrideOtherMouseUp =
    if (deferred) then
      hs.eventtap.rightClick(e:location(), pressedMouseButton)
      return true
    return false

local oldmousepos = {}
local scrollmult = 2 -- negative multiplier makes mouse work like traditional scrollwheel, for macOS, use positive number.

dragOtherToScroll =
    deferred = false
    oldmousepos = hs.mouse.getAbsolutePosition()
    local dx = e:getProperty(["mouseEventDeltaX"])
    local dy = e:getProperty(["mouseEventDeltaY"])
    local scroll = hs.eventtap.event.newScrollEvent({dx * scrollmult, dy * scrollmult}, {}, "pixel")
    -- put the mouse back
    return true, {scroll}


Then start Hammerspoon, or reload config if you’re already started it.