(This is a copy of an old post from the AutoHotkey forums.)
Lex' Mouse Gestures
Yet another mouse gestures script! I wrote this one (at least) several months ago, after trying various mouse gesture scripts and applications. For some I did not like the configuration methods, and for others I did not like the way gesture recognition worked.
This script allows gestures similar to the All-in-One Gestures addon for Firefox, since that is what I was used to.
I had been intending to rewrite the script and add more features, but... I'm too lazy. 
Gestures are triggered by holding the gesture key (default is right mouse button), drawing a sequence of "strokes" (line segments) then releasing the gesture key.
Features:
- Allows an arbitrary number of directions ("zones"), though 4 is the most practical and efficient.
- Allows any number of "strokes" in a gesture.
- Gestures either execute a label or send keystrokes.
- Wheel gestures (gesture key + wheel up/down.)
- Various options controlling gesture recognition. See Gestures Default.ahk for more information.
- Custom normal and suspended tray icons.
- Win + Gesture key enables/disables gestures, and indicates the current status by playing a sound from Wurt Simplicity.
- Note that it ignores the length of each stroke (excluding m_LowThreshold and m_HighThreshold), so two consecutive strokes cannot be in the same zone. For instance, Gesture_L_L is not valid, since it would be recognized as Gesture_L.
- Draw visible gestures on-screen by defining m_PenWidth in Gestures.ini. To define the colour, set m_PenColor to a RRGGBB colour code.
Script Structure:
Gestures.ahk contains the "gesture engine," while Gestures Default.ahk contains the default settings and any gestures which are implemented in script (vs pure keystrokes.) Gestures.ini is used to override settings, or define pure keystroke gestures.
When a gesture is executed, the script builds a label/variable name in the format:%c_GesturePrefix%_%zone1%_%zone2%_%zoneN%
For example:This represents left, then up. c_GesturePrefix is defined in Gestures Default.ahk, and is "Gesture" by default. It could be used by a label-associated gesture to easily switch between a "set" of gestures. (The script doesn't use this capability yet.)
If a variable exists of the relevant name, the variable's contents are sent as keystrokes.
If no variable exists, but a label does, the label is executed.
Default Gestures:
Implemented in Gestures Default.ahk as labels:
- Gesture_L (left) - Back - !{Left}, ^-, or Browser_Back depending on the active window.
- Gesture_R (right) - Forward.
- Gesture_D_R (down, then right) - Close the active window. A three second delay is implemented to allow cancelling by pressing Escape.
- Gesture_R_D_L_U (right, down, left, up) - Reload the script.
- Gesture_L_D_R_U (left, down, right, up) - Edit Gestures.ini.
- Gesture_L_D (left, down) - Minimize active window.
- Gesture_R_U (right, up) - Maximize active window.
- Gesture_R_L (right, left) or
Gesture_L_R (left, right) - Undo recent minimize, restore active window, or restore the "top-most" minimized window.
- Gesture_L_D_U (left, down, up) or
Gesture_U_L_D_U (up, left, down, up) - Restore the "top-most" minimized window. (Since the above gesture prefers to restore the active window if maximized.)
- Gesture_R_L_R_L (right, left, right, left) or
Gesture_L_R_L_R (left, right, left, right) - Enter "window move" mode. Click or press Enter to confirm window location. Press Escape to cancel. (This really just activates "Move" from the window's system menu.)
- Gesture_Default - Pressing the gesture key without moving the mouse executes Gesture_Default. If the gesture key is a mouse button, it simulates a click+drag from the gesture start point to the current mouse location, otherwise it sends a keystroke. Gesture_Default is also executed if the gesture is cancelled via m_Timeout and m_DefaultOnTimeout is non-zero.
Implemented in Gestures.ini as pure keystroke assignments:
- Gesture_WheelUp (gesture key + wheel up) - Ctrl+Shift+Tab.
- Gesture_WheelDown (gesture key + wheel down) - Ctrl+Tab.
- Gesture_L_U (left, up) - Up one level in Explorer/a file dialog.
- Gesture_U (up) - Launch_App1 (usually My Computer.)
- Gesture_D (down) - Launch_App2 (usually Calculator.)
- Gesture_D_U (down, up) - Browser_Home.
- Gesture_D_L (down, left) - ^F4 (usually close tab/document.)
- Gesture_D_R_L (down, right, left) - !F4 (close window without delay.)
Download (Includes script, default ini, tray icons and wurt sounds used by the script.)
Covered by Lexikos' default copyright license.