Skip to content

Commit

Permalink
Add Disable (Gaming Mode) option to the tray menu
Browse files Browse the repository at this point in the history
No need to restart the program when playing video games anymore, just disable it
and enable back later.
  • Loading branch information
nurupo committed Aug 16, 2017
1 parent 9f48a8b commit 7dc52ac
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 9 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@ Ctrl+PageUp and Ctrl+PageDown are Google Chrome hotkeys for navigating to the pr

Either download the executable from [Releases](https://github.com/nurupo/chrome-mouse-wheel-tab-scroller/releases), or use the AutoIt script directly if you have [AutoIt installed](https://www.autoitscript.com/site/autoit/downloads/). Throw it into Startup folder in the Start menu so that it would start on system startup and you are all set.

Note that the program might affect mouse performance, especially in video games, so if your mouse doesn't act as it should, you might want to close the program temporarily.
Note that the program might affect mouse performance, especially in video games, so if your mouse doesn't act as it should, you might want to disable the program temporarily from the tray menu.

Also note that antiviruses like to mark any AutoIt application as a virus, even if such application is benign, so don't be too surprised if your antivirus complains about the executable.

## Attribution

This script uses [MouseOnEvent UDF](https://www.autoitscript.com/forum/topic/64738-mouseonevent-udf/), which is included in the repository for the convenience.

The application icon is a combination of [Google Chrome icon](https://www.iconfinder.com/icons/1298719/chrome_google_icon) by [Just UI](https://www.iconfinder.com/justui) and a [tab icon](https://www.iconfinder.com/icons/3256/tab_icon) by [Everaldo Coelho](http://www.everaldo.com/).
The application icon is a combination of [Google Chrome icon](https://www.iconfinder.com/icons/1298719/chrome_google_icon) by [Just UI](https://www.iconfinder.com/justui), [tab icon](https://www.iconfinder.com/icons/3256/tab_icon) by [Everaldo Coelho](http://www.everaldo.com/) and [x icon](https://www.iconfinder.com/icons/1398917/circle_close_cross_delete_incorrect_invalid_x_icon) by [iconpack](https://www.iconfinder.com/iconpack).

## License

Expand Down
42 changes: 35 additions & 7 deletions chrome-mouse-wheel-tab-scroller.au3
Original file line number Diff line number Diff line change
Expand Up @@ -26,22 +26,28 @@

#AutoIt3Wrapper_UseUpx=n
#AutoIt3Wrapper_icon=icon.ico
#AutoIt3Wrapper_Res_Icon_Add=icon_disabled.ico
#AutoIt3Wrapper_Res_Comment=Scroll Chrome tabs using mouse wheel
#AutoIt3Wrapper_Res_Description=Scroll Chrome tabs using mouse wheel
#AutoIt3Wrapper_Res_Fileversion=0.0.2.0
#AutoIt3Wrapper_Res_Fileversion=0.1.0.0
#AutoIt3Wrapper_Res_LegalCopyright=Maxim Biro

#include "MouseOnEvent.au3"

$CHROME_TABS_AREA_HEIGHT_MAXIMIZED = 28
$CHROME_TABS_AREA_HEIGHT_NOT_MAXIMIZED = 48
$CHROME_NONTABS_AREA_RIGHT_WIDTH_OFFSET_MAXIMIZED = 200
$CHROME_NONTABS_AREA_RIGHT_WIDTH_OFFSET_NOT_MAXIMIZED = 150
Const $CHROME_TABS_AREA_HEIGHT_MAXIMIZED = 28
Const $CHROME_TABS_AREA_HEIGHT_NOT_MAXIMIZED = 48
Const $CHROME_NONTABS_AREA_RIGHT_WIDTH_OFFSET_MAXIMIZED = 200
Const $CHROME_NONTABS_AREA_RIGHT_WIDTH_OFFSET_NOT_MAXIMIZED = 150

_MouseSetOnEvent($MOUSE_WHEELSCROLLUP_EVENT, "mouseWheelUp")
_MouseSetOnEvent($MOUSE_WHEELSCROLLDOWN_EVENT, "mouseWheelDown")
Dim Const $HOOKS[2][2] = [ _
[$MOUSE_WHEELSCROLLUP_EVENT, "mouseWheelUp"], _
[$MOUSE_WHEELSCROLLDOWN_EVENT, "mouseWheelDown"] _
]

registerHooks()

Opt("TrayMenuMode", 1)
$trayDisable = TrayCreateItem("Disable (Gaming Mode)")
$trayExit = TrayCreateItem("Exit")
TraySetClick(16)
TraySetState()
Expand All @@ -51,11 +57,33 @@ While 1
Select
Case $msg = $trayExit
Exit
Case $msg = $trayDisable
$trayDisableState = TrayItemGetState($trayDisable)
Select
Case BitAnd($trayDisableState, $TRAY_CHECKED)
TraySetIcon(@ScriptFullPath, 201)
unregisterHooks()
Case BitAnd($trayDisableState, $TRAY_UNCHECKED)
TraySetIcon(@ScriptFullPath, 99)
registerHooks()
EndSelect
EndSelect

Sleep(10)
WEnd

Func registerHooks()
For $i = 0 To UBound($HOOKS, 1) - 1
_MouseSetOnEvent($HOOKS[$i][0], $HOOKS[$i][1])
Next
EndFunc

Func unregisterHooks()
For $i = 0 To UBound($HOOKS, 1) - 1
_MouseSetOnEvent($HOOKS[$i][0])
Next
EndFunc

Func isMouseInChromeTabsArea()
$windowList = WinList("[REGEXPCLASS:Chrome_WidgetWin_]")
For $i = 1 To $windowList[0][0]
Expand Down
Binary file added icon_disabled.ico
Binary file not shown.

0 comments on commit 7dc52ac

Please sign in to comment.