Emulating Volumouse (win) functionality in KM?

Hi all,
Searched the forum and couldn't find anything. I am moving from PC to fully Mac after 25 years (!) and am looking for an app or someway to emulate the functionality of **Clicking my LEFT mouse key ** and *scrolling my mouse UP ** to emulate Volume UP

The opposite (Click mouse, middle mouse scrolling down) to emulate volume DOWN

I want to have granular control of the volume at some of the smallest increments Mac OS will allow. Is there any way to do this?

Steermouse could be an option -- example of it solving your exact same question here: https://apple.stackexchange.com/questions/367228/control-volume-with-right-mouse-button-mouse-wheel. Do check your hardware -- IIRC it was mentioned in a post here that it didn't work with the Magic Mouse.

Off the top of my head -- you could do this in KM with a hotkey triggered macro that:

  1. Grabbed the current pointer position
  2. Moved and clicked on the menu bar "Volume" icon (which would have to be set to "Show" in Sys Prefs->Sound)
  3. Entered a wait-loop, during which you could scroll the volume, until...
  4. Another keystroke ended the loop and the macro...
  5. keypressed the esc key to close "Volume"
  6. Put the pointer back in its original position
1 Like

I don't want to pay for another piece of software, but I do have BetterTouchTool (BTT). Do you know if it would be possible to achieve it there?

Edit: or perhaps USB overdrive?

Not a clue -- poke it and find out!

Meanwhile, here's a KM macro to keep you going. It's almost exactly as described above except there's no "wait loop". It simply pauses, letting you scroll to set the volume, until you hit the esc key -- which, handily, also closes the "Volume" dialog -- then puts your pointer back where it was when you ran the macro.

Currently triggered via ⌃⌘V, so change to suit...

Set Volume with Scroll.kmmacros (11.8 KB)

Image

1 Like

As an addendum to what @Nige_S is giving you, it might just be worth pointing out that the steps in his Macro make use of an inbuilt macOS functionality.

In other words, if you don't mind moving and clicking the mouse you can use the scroll function of the mouse to raise and lower volume by clicking on the speaker icon, hovering the mouse over the volume bar and scrolling up or down. So, you can achieve almost what you want without any extra automation.

Screen Recording 2022-07-19 at 09.53.18-Animated GIF

2 Likes

Yep -- and that's what I actually do. But I'm guessing that (one of) the attractions of Volumouse to OP is that you don't have to move the mouse at all, and this is the cleanest way I could think of to emulate that.

Ya if the mouse has to move then it kills the incentive of trying to do this via mouse as I don't want my cursor to move. I thought perhaps KM could do this but it sounds like not without some workarounds.
I'll have to decide whether $20 for Steermouse is worth it for just this one functionality.

Have you tried the macro? The mouse doesn't move, and while the cursor does it goes back to where it was when you triggered the macro, so unless you've a need to keep the cursor in the same place it's effectively the same.

But do you actually need finer volume increments than the keyboard volume buttons give? Yes, you'd have to take your hand of the mouse/trackpad to punch the buttons but presumambly you'd be doing that to trigger the macro.

Unless you're using a third-party keyboard, of course...

1 Like

I use the script below in HammerSpoon to control volume with right mouse button + wheel.

It's not quite as perfect as I'd like. I wish that the context menu would not pop up when I press the right button down, but I can't find any way to avoid it. So I'll often move the mouse somewhere I know is safe to have a context menu momentarily open.

AFAICT, the problem is that Mac OS executes the right mouse button action on button down rather than button up like Windows does. I have some thumb buttons on my mouse that I'd rather use, but I can't seem to get HammerSpoon or Karabiner to become aware of them. I have not tried KeyboardMaestro yet for anything.

The best thing about it is the 2% volume increments (smaller than the system normally allows I think), and the alerts telling you the precise level. You could change that to 1% or anything you like.

volume_control = eventtap.new({eventtap.event.types.scrollWheel}, function(event)
    if eventtap.checkMouseButtons()[2] then
        hs.eventtap.keyStroke({}, "escape", 0); -- Make the context menu disappear
        local vol = hs.audiodevice.defaultOutputDevice():volume()
        if (event:getProperty(hs.eventtap.event.properties.scrollWheelEventDeltaAxis1) < 0) then vol = vol + 2 end
        if (event:getProperty(hs.eventtap.event.properties.scrollWheelEventDeltaAxis1) > 0) then vol = vol - 2 end
        hs.audiodevice.defaultOutputDevice():setVolume(vol)
        hs.alert.closeAll()
        hs.alert.show(string.format("Volume: %3.0f%%", hs.audiodevice.defaultOutputDevice():volume()), {}, hs.screen.mainScreen(), 0.4)
        return true
    end
end):start()