A Chrome extension (Manifest V3) that helps people with ADHD stay on task. It uses your webcam, on-device, to detect when your attention drifts from the screen and responds with gentle, configurable interventions — calming brown noise, a guided-breathing prompt, a break reminder, or a stretch suggestion.
Privacy first: all computer vision runs locally in your browser with OpenCV.js. Your webcam video is never uploaded, recorded, or sent anywhere.
┌────────────┐ start ┌──────────────────────┐ "inattentive" ┌────────────────────┐
│ Popup │ ─────────▶ │ Focus Monitor tab │ ──────────────▶ │ Service worker │
│ (settings) │ │ webcam + OpenCV.js │ │ (interventions) │
└────────────┘ │ Haar face/eye det. │ └─────────┬──────────┘
▲ └──────────────────────┘ │
│ saved settings notifications ◀──┤
└─────────────────────────────────────────── brown noise (offscreen) ◀─┘
- Popup — start/stop a focus session and choose which interventions you want. Settings persist in
chrome.storage. - Focus Monitor tab (
eye-tracking.html) — opens on start, accesses the webcam, and runs OpenCV.js Haar-cascade face + eye detection every frame. If no eyes are detected for a sustained window (~8s), it messages the background worker. - Service worker (
background.js) — on an "inattentive" signal, fires only the interventions you enabled, with a 60-second cooldown so it never nags. - Offscreen document (
offscreen.html/js) — MV3 service workers can't play audio, so brown noise is synthesized with the Web Audio API in an offscreen document.
- 👁️ On-device attention detection — OpenCV.js Haar cascades, no cloud, no data leaves your machine
- 🎧 Calming brown noise — synthesized in real time (no audio files), with fade in/out
- 🌬️ Guided breathing, ☕ break reminders, 🧘 stretch suggestions — as native notifications
- ⚙️ Fully configurable — pick any combination of interventions; choices are remembered
- 🔒 Cooldown so nudges stay gentle, not spammy
git clone https://github.com/Nanduu24/ADHD-Focus-Companion.git- Open
chrome://extensionsand turn on Developer mode (top right). - Click Load unpacked and select the project folder.
- Pin the extension, click it, choose your interventions, and press Start focus.
- Grant camera access when the Focus Monitor tab opens.
| Permission | Why |
|---|---|
storage |
Remember your intervention settings and session state |
notifications |
Deliver breathing / break / stretch nudges |
offscreen |
Play brown noise (audio isn't allowed in a service worker) |
tabs |
Open and close the Focus Monitor tab |
| camera (runtime prompt) | Local face/eye detection — video never leaves the device |
JavaScript · Chrome Extensions Manifest V3 (service worker, offscreen documents) · OpenCV.js (Haar cascade classifiers) · Web Audio API · chrome.storage / chrome.notifications.
- Detection is presence-based (face/eyes visible), not full gaze estimation — good enough to catch "looked away," not fine-grained gaze tracking.
- Lighting affects Haar-cascade reliability; a well-lit face works best.
- Next: session analytics dashboard, gaze-direction estimation, and configurable thresholds.
MIT