; ChromeTabsScroll.ahk ; script for AutoHotKey ; switch tabs by scroll and maximize window by double click ; on tab for Google Chrome #NoEnv #SingleInstance force IsChromeTabBar(winmax, xaxis, yaxis) { ; boundaries for normal window on vista/win7 topMin = 8 topMax = 42 if (winmax == 1) { ; top edge is offscreen topMin = 8 topMax = 30 } ; TODO also clip on left or right < 8 if (yaxis >= topMin and yaxis <= topMax) return 1 else return 0 } #IfWinActive ahk_class Chrome_WindowImpl_0 ; scroll on tab bar to switch tabs ~$WheelDown:: ~$WheelUp:: MouseGetPos,, yaxis,winid WinGet, winmax,MinMax,ahk_id %winid% if not IsChromeTabBar(winmax,-1,yaxis) return ifEqual, A_ThisHotkey,~$WheelDown, Send ^{PgDn} else Send ^{PgUp} return ; double click on tab to maximize ~LButton:: MouseGetPos,, yaxis,winid if (A_PriorHotkey == A_ThisHotkey and A_TimeSincePriorHotkey < 320) { if not IsChromeTabBar(winMaxOld,-1,yaxis) return Sleep 100 WinGet, winMaxNew,MinMax,ahk_id %winid% if (winMaxOld == winMaxNew) { if (winMaxNew == 0) WinMaximize else WinRestore } } else { WinGet, winMaxOld,MinMax,ahk_id %winid% } return #IfWinActive ; what a shitty language ;(