Skip to content

About

Chrome extension (MV3) that detects on-screen attention drift via the webcam with OpenCV and nudges you back with calming interventions — fully on-device.

Topics

Resources

Stars

0 stars

Watchers

1 watching

Forks

Repository files navigation

ADHD Focus Companion

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.


How it works

┌────────────┐   start    ┌──────────────────────┐  "inattentive"  ┌────────────────────┐
│   Popup    │ ─────────▶ │  Focus Monitor tab   │ ──────────────▶ │  Service worker    │
│ (settings) │            │  webcam + OpenCV.js  │                 │  (interventions)   │
└────────────┘            │  Haar face/eye det.  │                 └─────────┬──────────┘
      ▲                    └──────────────────────┘                           │
      │ saved settings                                        notifications ◀──┤
      └───────────────────────────────────────────  brown noise (offscreen) ◀─┘
  1. Popup — start/stop a focus session and choose which interventions you want. Settings persist in chrome.storage.
  2. 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.
  3. Service worker (background.js) — on an "inattentive" signal, fires only the interventions you enabled, with a 60-second cooldown so it never nags.
  4. 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.

Features

  • 👁️ 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

Install (load unpacked)

  1. git clone https://github.com/Nanduu24/ADHD-Focus-Companion.git
  2. Open chrome://extensions and turn on Developer mode (top right).
  3. Click Load unpacked and select the project folder.
  4. Pin the extension, click it, choose your interventions, and press Start focus.
  5. Grant camera access when the Focus Monitor tab opens.

Permissions & why

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

Tech

JavaScript · Chrome Extensions Manifest V3 (service worker, offscreen documents) · OpenCV.js (Haar cascade classifiers) · Web Audio API · chrome.storage / chrome.notifications.

Limitations & roadmap

  • 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.

License

MIT

About

Chrome extension (MV3) that detects on-screen attention drift via the webcam with OpenCV and nudges you back with calming interventions — fully on-device.

Topics

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages