A native macOS app for eye health monitoring. Track your blink rate, get break reminders, and protect your eyes from screen fatigue.
- Real-time blink detection using Apple's Vision framework
- Eye Aspect Ratio (EAR) algorithm for accurate blink detection
- Neural Engine optimized for low CPU usage
- Live camera preview with eye tracking visualization
- Automatic reminders every 20 minutes
- Full-screen break overlay with countdown timer
- Customizable intervals and break duration
- Skip or take break immediately options
- Health status monitoring (Healthy / Warning / Critical)
- System notifications when blink rate drops
- Sound alerts for immediate attention
- Visual menu bar indicators
- Session tracking with historical data
- Trend charts showing blink patterns
- Export to CSV/JSON for analysis
- SwiftData persistence for reliable storage
- Personal calibration for your eyes
- Adjustable thresholds for blink detection
- Keyboard shortcuts for quick control
- Launch at login option
- Prolonged eye closure detection
- Fatigue level indicators
- PERCLOS-based analysis
- macOS 14.0 (Sonoma) or later
- Mac with built-in camera or external webcam
- Camera permission for blink detection
- Clone the repository:
git clone https://github.com/yourusername/BlinkEye.git-
Open
BlinkEye.xcodeprojin Xcode -
Build and run (⌘+R)
-
Grant camera permission when prompted
Click the 👁️ icon in the menu bar to:
- View current blink rate and health status
- Start/Stop tracking
- Access camera preview
- View statistics
- Open settings
| Shortcut | Action |
|---|---|
| ⌘⇧B | Toggle tracking |
| ⌘⇧E | Show menu |
| ⌘⇧R | Take break now |
Shows live eye tracking with:
- Green box around detected face
- Cyan dots on eyes (red when blinking)
- Real-time EAR value and confidence
BlinkEye uses the Eye Aspect Ratio (EAR) algorithm to detect blinks:
- Face Detection: Vision framework detects face landmarks
- Eye Landmarks: Extracts 6 points around each eye
- EAR Calculation: Computes vertical to horizontal ratio
- Blink Detection: EAR drops below threshold = blink
The typical EAR is ~0.3 with open eyes and ~0.1 during a blink.
BlinkEye/
├── BlinkEyeApp.swift # App entry point & delegate
├── Models/
│ ├── BlinkSession.swift # Session data model
│ └── BlinkEvent.swift # Individual blink event
├── Services/
│ ├── CameraManager.swift # AVFoundation camera handling
│ ├── BlinkDetector.swift # Vision-based blink detection
│ ├── BlinkTracker.swift # Blink counting & rate calc
│ ├── AlertManager.swift # Notifications & alerts
│ ├── BreakReminderManager.swift # 20-20-20 rule
│ ├── CalibrationManager.swift # Personal calibration
│ ├── KeyboardShortcutManager.swift # Global hotkeys
│ ├── LaunchAtLoginManager.swift # Startup management
│ └── DataExportManager.swift # CSV/JSON export
└── Views/
├── MenuBarView.swift # Menu bar dropdown
├── CameraPreviewView.swift # Live camera feed
├── StatsView.swift # Statistics charts
├── SettingsView.swift # Preferences
└── Components/
├── BlinkRateGauge.swift # Rate visualization
└── BlinkChartView.swift # Trend charts
- CPU Usage: ~10-15% (optimized frame processing)
- Memory: ~90MB
- Frame Rate: 15 FPS (configurable)
- Battery: Minimal impact with adaptive processing
- All processing happens on-device
- No data is sent to external servers
- Camera data is never recorded or stored
- Only blink statistics are persisted locally
Contributions are welcome! Please feel free to submit a Pull Request.
MIT License - see LICENSE for details.
- Eye blink detection based on the EAR algorithm by Soukupová and Čech (2016)
- Icons from SF Symbols
- Built with SwiftUI, Vision, and AVFoundation
Made with ❤️ for healthy eyes