Trackman Marble with xset

The Trackman Marble is a great mouse I've been using for over a decade now. By default on linux / within X, scrolling funcionality doesnt not work. Instead, by default the small mouse buttons act as browser forward/back. Because, I've had to set this up so many times with Xorg's /etc/X11/Xorg.conf, and that feels very 2005 at this point, I've moved over to a small userland script.

Using xset w/ libinput I've found is the most pain-free solution to set the mouse to your liking. For my purposes, really all I wanted was to hold down the left small button in order to access a scroll modifier. So you hold the button and then you can use the trackball for scrolling. Well, that's enough blathering, here's the script I use1: