Skip to content

Instantly share code, notes, and snippets.

@ansidev
Created December 4, 2016 14:56
Show Gist options
  • Star 5 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ansidev/f8060bc1061019bf19a73d90fa78d8d3 to your computer and use it in GitHub Desktop.
Save ansidev/f8060bc1061019bf19a73d90fa78d8d3 to your computer and use it in GitHub Desktop.
Mouse Wheel Tab Scroll For Chrome
; Mouse Wheel Tab Scroll 4 Chrome
; -------------------------------
; Scroll though Chrome tabs with your mouse wheel when hovering over the tab bar.
; If the Chrome window is inactive when starting to scroll, it will be activated.
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
#Warn ; Enable warnings to assist with detecting common errors.
#SingleInstance force ; Determines whether a script is allowed to run again when it is already running.
#UseHook Off ; Using the keyboard hook is usually preferred for hotkeys - but here we only need the mouse hook.
#InstallMouseHook
#MaxHotkeysPerInterval 1000 ; Avoids warning messages for high speed wheel users.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
Menu, Tray, Tip, Mousewheel Tab Scroll for Chrome (1.0.4)
WheelUp::
WheelDown::
MouseGetPos,, ypos, id
WinGetClass, class, ahk_id %id%
If (ypos < 45 and (InStr(class,"Chrome_WidgetWin") or InStr(class, "MozillaWindowClass") or InStr(class, "ApplicationFrameWindow")))
{
IfWinNotActive ahk_id %id%
WinActivate ahk_id %id%
If A_ThisHotkey = WheelUp
Send ^+{Tab}
Else
Send ^{Tab}
}
Else
{
If A_ThisHotkey = WheelUp
Send {WheelUp}
Else
Send {WheelDown}
}
Return
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment