Last active
December 30, 2025 21:14
-
-
Save deitrix/8be36689bebb65421d535efb73b7ae4e to your computer and use it in GitHub Desktop.
Volume and Twinkle Tray with mouse scroll
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #Requires AutoHotkey v2.0 | |
| #SingleInstance Force | |
| ; --- Configuration --- | |
| DebounceTime := 200 | |
| LastBackDown := 0 | |
| LastForwardDown := 0 | |
| ; --- 1. BACK BUTTON (XButton1) - Volume --- | |
| ; Custom Combination: Hold Back + Scroll | |
| XButton1 & WheelUp:: Send("{Volume_Up}") | |
| XButton1 & WheelDown::Send("{Volume_Down}") | |
| ; Intercept the Down event to filter stutters | |
| *XButton1:: { | |
| global LastBackDown | |
| currentTick := A_TickCount | |
| if (currentTick - LastBackDown < DebounceTime) { | |
| ToolTip("Debounced (Back Down): " . (currentTick - LastBackDown) . "ms") | |
| SetTimer () => ToolTip(), -1000 | |
| return ; Block the stutter | |
| } | |
| LastBackDown := currentTick | |
| Click("Down X1") | |
| } | |
| ; Ensure the Up event always fires if the Down event was accepted | |
| *XButton1 Up:: { | |
| if GetKeyState("XButton1") | |
| Click("Up X1") | |
| } | |
| ; --- 2. FORWARD BUTTON (XButton2) - Brightness --- | |
| ; Custom Combination: Hold Forward + Scroll | |
| XButton2 & WheelUp:: Send("#{Numpad9}") | |
| XButton2 & WheelDown::Send("#{Numpad1}") | |
| ; Intercept the Down event to filter stutters | |
| *XButton2:: { | |
| global LastForwardDown | |
| currentTick := A_TickCount | |
| if (currentTick - LastForwardDown < DebounceTime) { | |
| ToolTip("Debounced (Forward Down): " . (currentTick - LastForwardDown) . "ms") | |
| SetTimer () => ToolTip(), -1000 | |
| return ; Block the stutter | |
| } | |
| LastForwardDown := currentTick | |
| Click("Down X2") | |
| } | |
| ; Ensure the Up event always fires if the Down event was accepted | |
| *XButton2 Up:: { | |
| if GetKeyState("XButton2") | |
| Click("Up X2") | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment