Linux Mint-like scroll to change sound volume on Windows 10

Back in my first year of college, we had a class where you’d get bonus points for installing a Linux distro in dual boot. A nice gimmick I’ve found out about Linux Mint was that you can change the sound volume by scrolling while hovering over the sound icon: scrolling up increased the volume, scrolling down decreased it. I liked it so much after using it constantly for about two months that I found myself missing it on Windows once the suffering (the semester/that class) ended. So, here’s the script, with the caveat that it is impossible to target only the sound icon like on Linux Mint; instead, you can scroll over the entire taskbar to change the volume (it works even in multi-monitor setups!). If this is a dealbreaker, it’s up to you; I find it more useful.

SendMode Input
SetWorkingDir %A_ScriptDir% 

#if MouseIsOver("ahk_class Shell_TrayWnd") || MouseIsOver("ahk_class Shell_SecondaryTrayWnd")
  WheelUp::Send {Volume_Up}
  WheelDown::Send {Volume_Down}
#If

MouseIsOver(WinTitle){  
  MouseGetPos,,, Win
  Return WinExist(WinTitle . " ahk_id " . Win)
}

return 

Of course, going from a procedure like click on sound icon, move the volume slider or press that keyboard shortcut or, for laptop users, take your hand off the mouse and use three fingers to change the volume1, to going for an effortless move the mouse down on the taskbar and scroll2 might prove by far the most convenient way (at least when using a mouse), but it sometimes makes me ask myself if or how can this backfire against me, getting so used to just hovering the taskbar that my brain won’t accept any other way… maybe I dramatize.

Notes

  1. Of course, if your touchpad supports it, your default gestures might differ; check your settings. 

  2. I have to mention that it works only with physical mices. On laptops, scrolling events on touchpads (two fingers up/down) for some reason are not picked up by AutoHotkey, so you can’t move the cursor and scroll on the touchpad to increase/decrease the sound volume.