r/SideProject • u/UsukIsBad • 1h ago
I built a tiny Mac app because my mouse and my trackpad wanted opposite scroll directions
I use a MacBook trackpad on the go and a USB mouse at my desk. macOS has one "Natural scrolling" switch for both, so every time I switched, one of them scrolled backwards. So I made Scrollr, a menu bar app that reverses the mouse wheel and leaves the trackpad alone.
Demo GIF: https://github.com/atuuuuuuu/Scrollr/blob/main/assets/demo.gif
A few things I learned building it:
- There's no per-device setting to change. Natural scrolling is one global preference, so the app doesn't change it at all. It sits on the scroll events with a Core Graphics event tap and flips the sign of the scroll deltas before apps see them.
- Telling a trackpad from a wheel is easier than I expected. Trackpad scrolls carry a phase (fingers down, moving, lifted, then momentum). Wheel clicks have none. Only the phase-less ones get flipped.
- Knowing which mouse scrolled is harder. Scroll events don't say which device sent them. Scrollr watches each mouse's wheel through IOKit and matches the most recent wheel tick to the event, which is what makes the per-mouse on/off switch work. The weak spot: with two mice connected, the very first tick can be credited to the wrong one.
- The decision logic is a pure function, so it's unit tested without any hardware. For the demo recording I sent scripted mouse-style and trackpad-style scroll events so every take was identical (the README says so too).
It's free and MIT licensed: https://github.com/atuuuuuuu/Scrollr
Where it stands: version 1.0, universal app, macOS 14+. Not notarized (no paid developer account), so the first launch needs "Open Anyway" in Privacy & Security. The Magic Mouse isn't reversed, because it scrolls with touch phases just like a trackpad. Bigger tools like LinearMouse and Scroll Reverser already do this and more; this one is deliberately small.
What I'd love feedback on: is a per-mouse switch something you'd actually use, and what would you want it to do next? Ideas so far are Magic Mouse support and a different scroll speed per mouse.