Skip to content

Instantly share code, notes, and snippets.

@hrko
Created January 26, 2021 07:33
Show Gist options
  • Save hrko/1ffcdc017646c5210a124120e909640b to your computer and use it in GitHub Desktop.
Save hrko/1ffcdc017646c5210a124120e909640b to your computer and use it in GitHub Desktop.
Wheel Scroll Tabs for Google Chrome
; Wheel Scroll Tabs for Google Chrome
#UseHook
; Improve the performance
#NoEnv
SetBatchLines -1
ListLines Off
; Pause the script if it receives 200 key events within 1,000 ms
#HotkeyInterval 1000
#MaxHotkeysPerInterval 200
SendIfMouseIsOnChromeHeader(Key) {
MouseGetPos, , , WinId, CtrClsNN, 0
WinGet, ProcName, ProcessName, ahk_id %WinId%
WinGetClass, WinClass, ahk_id %WinId%
WinGetText, WinTxt, ahk_id %WinId%
if (CtrClsNN == "Intermediate D3D Window1" and ProcName == "chrome.exe" and WinClass == "Chrome_WidgetWin_1" and InStr(WinTxt, "Chrome Legacy Window")) {
if !(WinActive("ahk_id" . WinId)) {
WinActivate, ahk_id %WinId%
}
Send %Key%
}
Return
}
~WheelDown::
~WheelRight::
SendIfMouseIsOnChromeHeader("^{PgDn}")
Return
~WheelUp::
~WheelLeft::
SendIfMouseIsOnChromeHeader("^{PgUp}")
Return
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment