Skip to content

Instantly share code, notes, and snippets.

@thefloodshark
Last active June 11, 2025 10:00
Show Gist options
  • Save thefloodshark/b148a7784c60daabbb9e64378486f557 to your computer and use it in GitHub Desktop.
Save thefloodshark/b148a7784c60daabbb9e64378486f557 to your computer and use it in GitHub Desktop.
Hover over any taskbar and mouse wheel scroll to change volume
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn ; Enable warnings to assist with detecting common errors.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
#If MouseIsOver("ahk_class Shell_TrayWnd") or MouseIsOver("ahk_class Shell_SecondaryTrayWnd")
WheelUp::Send {Volume_Up}
WheelDown::Send {Volume_Down}
MouseIsOver(WinTitle)
{
MouseGetPos,,, Win
return WinExist(WinTitle . " ahk_id " . Win)
}
~#!x::Suspend
@DoYouKnowMyNamePlz
Copy link

#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn ; Enable warnings to assist with detecting common errors.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.

#If MouseIsOver("ahk_class Shell_TrayWnd") or MouseIsOver("ahk_class Shell_SecondaryTrayWnd")
WheelUp::Send {Volume_Up}
WheelDown::Send {Volume_Down}
MButton::Send {Volume_Mute} ; Middle mouse click to mute/unmute

#If ; End of context-sensitive hotkeys

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

~#!x::Suspend

Alternative if you want mute when clicking scroll wheel.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment