Skip to main content
KM

MiddleDrag

Native macOS app that adds three-finger trackpad gestures for middle-click and middle-drag. Distributed via Homebrew and MacPorts.

The problem

Mac trackpads don't have a middle mouse button. Dozens of apps expect one — Blender, Figma, VS Code, every 3D CAD tool, every browser for "open in new tab." The existing solutions are either paid, closed-source, or require terminal configuration with no GUI.

What it does

MiddleDrag intercepts raw touch data from Apple's private MultitouchSupport framework before the system gesture recognizer processes it. Three-finger tap becomes middle-click. Three-finger drag becomes middle-drag. Mission Control and other system gestures remain functional — the app coexists with them rather than replacing them.

The technical flow:

  1. MultitouchSupport framework provides raw touch coordinates
  2. Custom gesture recognizer detects three-finger tap/drag patterns
  3. Accessibility API generates synthetic middle-mouse events
  4. CGEventTap suppresses conflicting system click events

Distribution

MiddleDrag is a real shipped product with multiple distribution channels:

  • Homebrew: brew install --cask middledrag
  • MacPorts: sudo port install MiddleDrag
  • Direct download: Signed .pkg installer with GitHub Artifact Attestations for cryptographic provenance verification

Engineering highlights

Private framework integration — Uses Apple's undocumented MultitouchSupport framework to access raw multi-touch data, requiring careful reverse engineering and compatibility testing across macOS versions (Sequoia through Tahoe beta).

Gesture coexistence — The hardest problem wasn't detecting three-finger gestures — it was doing so without breaking Mission Control, Exposé, and other system gestures that also use multi-finger input. The solution intercepts touch data at a lower level than the system recognizer and uses CGEventTap to selectively suppress conflicts.

Native macOS app — Menu bar interface, configurable sensitivity and smoothing, launch-at-login support. No Electron, no terminal configuration.

Production infrastructure — Sentry crash reporting, Sparkle auto-updates, Codecov coverage tracking, FOSSA license compliance scanning, GitHub Actions CI/CD pipeline.