A Chrome extension that allows you to define and execute custom gestures on websites with modifier key support. Works seamlessly with OS and browser gestures by using modifier keys (Alt, Ctrl, Shift) to distinguish custom gestures from default behaviors.
- Custom Gesture Recognition: Define swipe gestures (left, right, up, down) with modifier keys
- Site-Specific Gestures: Configure different gestures for different websites
- Visual Feedback: See your gestures as you perform them with real-time trail visualization
- Pre-configured Presets: Quick setup for popular sites (YouTube, GitHub, Gmail)
- Multiple Action Types: Navigate, scroll, tab management, media control, custom scripts
- Non-Intrusive: Only intercepts gestures with modifier keys, allowing normal browser behavior
- Full UI: Popup shows active gestures, Options page for configuration
- Clone or download this repository
- Install dependencies:
npm install
- Build the extension:
npm run build
- Load in Chrome:
- Open
chrome://extensions/ - Enable "Developer mode" (top right)
- Click "Load unpacked"
- Select the
distfolder
- Open
- Click the extension icon in Chrome toolbar
- Click "Configure Gestures"
- Click on a preset card (YouTube, GitHub, or Gmail)
- Visit the site and try the gestures!
YouTube:
- Alt + Swipe Right: Play/Pause video
- Alt + Swipe Up: Volume up
- Alt + Swipe Down: Volume down
- Alt + Swipe Left: Mute/Unmute
GitHub:
- Alt + Swipe Left: Go back
- Alt + Swipe Right: Go forward
- Alt + Swipe Up: Scroll to top
- Alt + Swipe Down: Scroll to bottom
Gmail:
- Alt + Swipe Right: Archive email
- Alt + Swipe Left: Delete email
- Alt + Swipe Down: Mark as read
- Open extension options (right-click icon → Options)
- Click "+ Add New Gesture"
- Configure:
- Site Pattern: Leave empty for all sites, or specify domain (e.g.,
youtube.com) - Gesture Pattern: Choose swipe direction
- Modifier Keys: Select Alt, Ctrl, and/or Shift
- Action Type: Choose what the gesture does
- Action Parameter: Specify the action details
- Site Pattern: Leave empty for all sites, or specify domain (e.g.,
- Click "Save Gesture"
- Navigate:
back,forward,reload - Scroll:
up,down,top,bottom - Tab:
new,close,next,prev - Media:
play,pause,playPause,mute,volumeUp,volumeDown - Script: Custom JavaScript code to execute
The extension follows this flow:
- User performs a gesture (with modifier keys)
- Extension detects the gesture
- If gesture is mapped → Execute custom action
- If gesture is not mapped → Allow normal browser behavior
This design ensures that:
- Default Chrome gestures still work (e.g., swipe without modifiers)
- Site-specific gestures still work
- Only gestures with modifier keys trigger custom actions
src/
├── background/
│ ├── configuration-manager.js # Manages gesture configuration
│ └── service-worker.js # Background service worker
├── content/
│ ├── content-script.js # Main coordinator
│ ├── event-interceptor.js # Captures pointer events
│ ├── gesture-recognizer.js # Pattern matching
│ ├── gesture-handler.js # Action execution
│ └── visual-feedback.js # Visual gesture feedback
├── shared/
│ ├── constants.js # Shared constants
│ ├── types.js # Type definitions
│ └── utils.js # Utility functions
└── ui/
├── options.html/js # Options page
└── popup.html/js # Extension popup
- EventInterceptor: Captures pointer events with 50ms delay for OS gesture priority
- GestureRecognizer: Analyzes movement patterns and matches against configured gestures
- GestureHandler: Executes the mapped action (6 built-in action types)
- VisualFeedback: Shows real-time gesture trail with SVG overlay
- ConfigurationManager: Manages gesture storage and site-specific presets
- ServiceWorker: Background lifecycle and message handling
- EventInterceptor: Captures pointer events and tracks modifier keys
- GestureRecognizer: Analyzes movement (distance, direction, velocity, duration)
- GestureHandler: Executes action if gesture matches configuration
- VisualFeedback: Shows blue trail during gesture, green/red flash on completion
npm testAll 113 tests pass, covering:
- Event interception and modifier key tracking
- Gesture recognition and pattern matching
- Action execution for all handler types
- Configuration management
- Service worker message handling
npm run build # Production build
npm run build:dev # Development build with source maps- Minimum Distance: 100px
- Maximum Duration: 500ms
- Multi-touch Support: Up to 5 simultaneous touch points
- Modifier Keys: Alt, Ctrl, Shift, Meta
- OS Gesture Delay: 50ms to allow OS gestures priority
- Chrome/Edge (Manifest V3)
- Supports mouse, touchpad, and touchscreen input
- Requires Pointer Events API support
storage: Save gesture configurationactiveTab: Execute actions on current tab<all_urls>: Inject content script on all pages
MIT License - feel free to use and modify!
Contributions welcome! Please ensure all tests pass before submitting PRs.
npm testGestures not working?
- Make sure you're holding the modifier key (Alt by default)
- Check that gestures are configured for the current site
- Reload the page after installing/updating the extension
Visual feedback not showing?
- Visual feedback is enabled by default
- Check browser console for errors
Conflicts with other extensions?
- Try disabling other gesture extensions
- Use different modifier key combinations