gazectl
github.com/jnsahaj/gazectl- Category
- Productivity
- Rank
- No. 3027Tools index
Previous survey · No. 2931 ·
- Pricing
- Open Source
- Type
- TOOL
- Use case
- Workflow Automation
- Interfaces
- Desktop
- Builder
- @iamsahaj_xyz
- GitHub
- 134 stars
- Latest release
- v0.8.2
- Date
About
A macOS app that automatically switches focus between monitors by tracking which one you're looking at using your webcam. Uses Apple's Vision framework for real-time head tracking and switches display focus without requiring third-party window managers.
What it does
gazectl is a small command-line program for Mac users with two or more screens. You calibrate once by looking at each screen and pressing Enter; it records the angle of your head for two seconds per screen. After that it watches the camera, and when you turn toward a different screen it jumps the mouse pointer to that screen's center and clicks there, so whatever sits under that point becomes active. A double blink pauses or resumes it.
Why it's ranked here
It solves one narrow, annoying problem for multi-screen users and does it in plain, readable Swift with no helper daemon and no window manager. The code is more careful than the pitch suggests: head angles are smoothed, the screen you are on gets a 25 percent distance bonus so it does not flicker at borders, and switches are rate-limited to one per half second. MIT licensed and installable with a single npm command, it is cheap to try and easy to remove.
What's good
Setup is short: grant camera and accessibility permissions, run it, look at each screen. Screen choice uses both horizontal and vertical head angle, so stacked monitors can be told apart, not just side-by-side ones. The double-blink toggle is tuned with explicit gaps and a cooldown, which keeps ordinary blinking from triggering it. Startup fails loudly when it finds fewer than two screens or no camera frames, and points you at the privacy setting to check. The npm build ships one binary for both Apple Silicon and Intel Macs.
Tradeoffs
Focus changes by clicking the exact center of the target screen, so that click lands on whatever happens to be there, including a button or link. The source comments admit focus detection from a command-line tool is unreliable and that you may still need to click an app yourself. It runs in a terminal loop rather than as a menu bar app, needs macOS 14 or later, and requires accessibility rights to move the pointer and post clicks. The README describes a midpoint rule, while the code actually picks the nearest calibrated point.
How to use it well
Try it if you sit centered in front of two or three screens and keep losing track of which one has the pointer. Recalibrate whenever you move your chair or a monitor, and pick a specific camera by index if the default is not the one facing you. Keep the center of each screen clear of anything a stray click could trigger. It does not move windows, arrange layouts or follow true eye gaze, only head direction, so pair it with your usual window tools.
Technical notes+
Sources/FaceTracker.swift runs VNDetectFaceRectanglesRequest (revision 3) per frame for yaw and pitch, applies an EMA with smoothing 0.3, and runs VNDetectFaceLandmarksRequest to compute an eye aspect ratio with closed/open thresholds of 0.18/0.22 and double-blink gaps of 0.1 to 0.6 s plus a 1.5 s cooldown. Sources/Calibration.swift stores the median yaw and pitch per display ID in JSON and selects the target by Euclidean distance with a 0.25 hysteresis factor for the current monitor. Sources/MonitorManager.swift returns .moveAndClick whenever the cursor is on another display, calling CGWarpMouseCursorPosition then posting synthetic mouse down/up at the display center. Sources/main.swift polls every 0.033 s with a 0.5 s switch cooldown. scripts/build-npm-binary.sh lipo-merges arm64 and x86_64 builds.
Observed
- License
- MIT
- Language
- Swift (Swift Package Manager executable target)
- Install surface
- npm package gazectl (npx or global install); build from source with swift build
- Interface
- CLI with --calibrate, --calibration-file, --camera, --verbose and --debug flags
- Platform support
- macOS 14 or later only; npm package restricted to darwin; universal arm64 and x86_64 binary
- Frameworks
- Apple Vision, AVFoundation, CoreMedia, CoreVideo
- Permissions required
- Camera and Accessibility
- Minimum setup
- Exits unless at least two active displays are detected
Read from README.md, package.json, LICENSE, Package.swift, Sources/main.swift, Sources/CLI.swift, Sources/FaceTracker.swift, Sources/Calibration.swift, Sources/MonitorManager.swift, Sources/CameraCapture.swift, scripts/build-npm-binary.sh.
What it can do
Track user's head position and gaze direction
Webcam video feed → Real-time head position coordinates
Detect which monitor user is looking at
Head tracking data and monitor configuration → Target monitor identification
Switch display focus to target monitor
Target monitor identification → Updated system focus state
Automatically manage multi-monitor focus switching
Continuous gaze tracking data → Seamless focus transitions between displays
Process webcam input using Apple Vision framework
Raw webcam video stream → Vision-processed head tracking data
Tags
Tech Stack
Comments (0)
No comments yet
Editorially curated, with community endorsements as a secondary signal. Corrections welcome.