KM Macro for changing scrolling speed

Hi, I have looking to create a macro such that when I hold down a modifier key when scrolling with a mouse, it would increase the scrolling speed.

I have searching for past forum posts but couldn't find any regarding this, nor could I figure it out myself. Any advice on this much apprecaited!

Welcome to the forums, and I hate to start you off with a negative answer, but ... I'm not sure how you would do that. Are you saying you want to actually change macOS' scroll speed setting when you hold down a modifier key, then change it back when you release it?

That's about the only way I could see doing this, and it's not going to be very elegant: You have to script System Settings using GUI scripting (meaning it flashes on-screen), then you could scroll, then you'd have to do the same GUI scripting thing again to change it back to normal speed, with more windows flashing onscreen. And those things take a bit of time, so you'd have to wait for a second or so after pressing the modifier key before scrolling.

But the bigger issue, even assuming that could be made to work, is that the act of scrolling isn't a "trigger" in Keyboard Maestro—there's no way to detect that the mouse' scroll wheel is turning. So while you could set (for instance) a "Control key is pressed" trigger to launch your macro, the macro would then just start, regardless of whether you were using your scroll wheel or not, because it doesn't know what you're doing.

Keyboard Maestro does have an action that simulates a scroll wheel, so if you didn't mind not using the mouse, it's probably possible to make a macro that uses (for example) Control-Option down arrow and up arrows to make a passable keyboard alternative.

But as for the actual scroll wheel moving at a different speed only when a modifier is down? Hopefully someone else has some ideas, but I can't think of any way to get close to solving that.


Thank you for the reply, this sound completely out of my depth, but I appreciate the detailed explanation!

I have an idea. He could have a macro that runs in an infinite loop, and constantly checks if the "Option" key is depressed. If the macro detects that the key has just been pressed, it could write a different value into macOS using "defaults" command. Then when the modifier is released, it could write the original value back.

Off the top of my head I don't know which value needs to be changed, but that wouldn't take too long to find out.

I know some people object to the idea of an infinite loop that "polls" for some condition, but I don't object to this approach.

This was my first thought, but it seems changing that speed on the fly with defaults doesn't work:

From that page: ":warning: A restart of your Mac is required to apply these changes."

And while I haven't experimented to see if that's really required, changing it via defaults write has no effect on the actual speed, other than it does change the displayed value in System Settings. And that's why I went to GUI scripting of System Settings, because that would work, but gosh, it would be annoying.


You were one step ahead of me then.

Even so, if it were me, I would test it to be sure. It could be some versions of macOS don't have that requirement. Or it could be that some mice which come with drivers won't need a reboot. We don't even know which version of macOS the original poster has.

By the way, I had never seen that website about macOS defaults before. I'm saving it as a favourite. Thanks.

I tried on both my main Mac with Logitech mouse and on my laptop with the built-in trackpad. No joy in either case. I think GUI scripting is the only way to get it done.


1 Like