Skip to content

AndreasTopuh/TrackerMode

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

9 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🎯 TrackerMode v2.6

Notice: For the latest v2.6 Desktop Application, please navigate to the TrackerModeDesktop directory instead!

AI-powered focus tracking with real-time eye tracking, active window title monitoring, and AI session analysis.

TrackerMode monitors your focus during study or work sessions using your webcam (MediaPipe FaceLandmarker), keyboard/mouse activity, and active window title detection. It does not capture, record, or monitor your screen in any way β€” it only reads the window title text to detect distraction apps. When your focus drops or you open a distraction app, it alerts you with visual warnings and audio alarms.


πŸ”’ Privacy & Trust

TrackerMode is a self-discipline tool, not a surveillance app. You choose to use it.

What we access Why Stored?
Webcam Eye tracking (gaze, blink, head pose) ❌ Never saved
Keyboard/Mouse Detect inactivity ❌ Never saved
Active Window Title Detect distraction apps ❌ Never saved

What we DON'T do:

  • ❌ No screen monitoring β€” we do NOT capture, record, or view your screen at all
  • ❌ No screenshots β€” we never take screenshots or screen recordings
  • ❌ No screen content reading β€” we only read the window title bar text (e.g. "Google Chrome"), never your screen content
  • ❌ No data sent externally β€” all processing is local on your machine
  • ❌ No browsing history β€” we don't track URLs or web content
  • ❌ No keystroke logging β€” we only detect if you're typing, not what

The AI Analysis feature (optional) sends only session statistics (duration, focus score, alert count) to OpenAI β€” never webcam data, window titles, or personal content.


✨ Features

🧠 Focus Detection

  • Eye Tracking β€” MediaPipe 478-landmark face detection with iris tracking
  • Gaze Direction β€” Detects center/left/right gaze from iris position
  • Head Pose β€” Estimates forward/down/up/left/right head orientation
  • Blink Rate β€” Real-time blink detection via Eye Aspect Ratio (EAR)
  • Drowsiness Detection β€” Detects drowsy (3s+), microsleep (15s+), and deep sleep (60s+) states
  • Smart Scoring β€” Combined attention score (0–100) from eyes, gaze, head pose, face position, and blink rate

πŸ–₯️ Active App Monitor

  • Window Title Detection β€” Reads the active window title via pygetwindow
  • Distraction Detection β€” Flags known distraction apps (WhatsApp, Instagram, TikTok, Steam, etc.)
  • Custom Distractions β€” User can add their own app keywords to block
  • Confirmation Prompt β€” "Is this for studying?" instead of assuming. Whitelists per session
  • No Screen Capture β€” Only reads window title text, never captures screen content

πŸ“Š Live Dashboard

  • Focus Score Ring β€” Large circular gauge with color-coded score
  • Focus Timeline β€” Real-time chart showing score over time
  • Activity Log β€” Timestamped events with color-coded status
  • Floating Metrics Bar β€” Compact gauges for gaze, eyes, head, mouse, keyboard
  • Pop-out Metrics (PiP) β€” Separate small window visible across all tabs

πŸ”” Alerts & Alarms

  • Visual Alerts β€” PiP-style alert bar for focus warnings
  • Toast Notifications β€” Pop-up messages for events
  • Browser Push Notifications β€” Visible even when minimized
  • Audio Alarm β€” Loops alarm sound when focus drops severely (3+ consecutive alerts)
  • "I'm Back" Overlay β€” Fullscreen dismiss button to acknowledge and resume
  • Drowsiness Tolerance β€” Allows 3 episodes before first warning (human-friendly)
  • Smart Alert Cooldown β€” 30s between alerts with escalating severity
  • Video Mode β€” Pauses activity tracking when watching a video

πŸ€– AI Coach (Optional)

  • Post-Session Analysis β€” Click "Analisis dengan AI" to get AI feedback
  • Powered by GPT-4o-mini β€” Casual & supportive tone
  • API Credit Friendly β€” Only triggered on button click, not automatic

πŸ“± Activity Monitoring

  • Mouse Tracking β€” Detects mouse movement and idle time (30s threshold)
  • Keyboard Tracking β€” Monitors keypress activity (60s threshold)
  • Quiz System β€” Random focus check quizzes on severe distraction
  • Pomodoro Timer β€” Automatic cycles with break duration mapped to session length
  • Webcam Fallback β€” Auto keyboard/mouse-only mode if webcam disconnects

πŸ“ Project Structure

TrackerMode/
β”œβ”€β”€ TrackerModeDesktop/    # ⭐️ Version 2.5 Native Desktop App with PyInstaller
β”œβ”€β”€ TrackerMode/           # Legacy v2.4 web-based server
β”œβ”€β”€ server.py              # FastAPI backend + MediaPipe + WebSocket + pygetwindow
β”œβ”€β”€ main.py                # Standalone Python tracker (v1.0, Haar Cascades + dlib)
β”œβ”€β”€ requirements.txt       # Python dependencies
β”œβ”€β”€ .env                   # OpenAI API key
β”œβ”€β”€ face_landmarker.task   # MediaPipe model (auto-downloaded)
β”‚
└── static/
    β”œβ”€β”€ index.html          # Main app UI
    β”œβ”€β”€ pip.html            # Pop-out metrics window
    β”œβ”€β”€ favicon.svg         # App icon
    β”‚
    β”œβ”€β”€ css/
    β”‚   └── style.css       # All styles
    β”‚
    β”œβ”€β”€ js/
    β”‚   β”œβ”€β”€ main.js         # App entry point & orchestration
    β”‚   β”œβ”€β”€ session.js      # Session timer & focus scoring
    β”‚   β”œβ”€β”€ tracker.js      # Mouse/keyboard activity tracker
    β”‚   β”œβ”€β”€ webcam.js       # Webcam + WebSocket to MediaPipe
    β”‚   β”œβ”€β”€ dashboard.js    # Focus timeline chart & activity log
    β”‚   β”œβ”€β”€ quiz.js         # Focus check quiz system
    β”‚   β”œβ”€β”€ pip.js          # Pop-out metrics window manager
    β”‚   └── screencapture.js # Screen capture utilities
    β”‚
    β”œβ”€β”€ icon/               # SVG/PNG icons for UI elements
    β”‚   β”œβ”€β”€ logo.svg        # App logo
    β”‚   β”œβ”€β”€ logo.png        # App logo (raster)
    β”‚   β”œβ”€β”€ eye.svg         # Eye tracking icon
    β”‚   β”œβ”€β”€ keyboard.svg    # Keyboard activity icon
    β”‚   β”œβ”€β”€ mouse.svg       # Mouse activity icon
    β”‚   β”œβ”€β”€ screen.svg      # Screen monitor icon
    β”‚   β”œβ”€β”€ alert.svg       # Alert notification icon
    β”‚   β”œβ”€β”€ warning.svg     # Warning icon
    β”‚   β”œβ”€β”€ check.svg       # Success/check icon
    β”‚   β”œβ”€β”€ play.svg        # Play button icon
    β”‚   β”œβ”€β”€ pause.svg       # Pause button icon
    β”‚   └── bar_avg.svg     # Average bar icon
    β”‚
    └── audio/
        └── mixkit-urgent-simple-tone-loop-2976.mp3  # Alarm sound

πŸ”§ Tech Stack

Component Technology
Backend FastAPI + Uvicorn
Face Detection MediaPipe FaceLandmarker (Tasks API)
Fallback Haar Cascades (OpenCV)
Window Monitor pygetwindow (OS-level window title)
Input Tracking pynput (system-wide mouse/keyboard)
AI Analysis OpenAI
Frontend Vanilla HTML/CSS/JS
Communication WebSocket (real-time frames)
PiP Window window.open() popup
Audio HTML5 Audio API
Image Processing Pillow + NumPy

πŸ”Œ API Endpoints

Method Endpoint Description
WebSocket /ws/attention Real-time webcam frame analysis
POST /api/analyze AI-powered session analysis
GET /api/stats Get attention score statistics
GET /api/input-status Mouse/keyboard + active window status
POST /api/distractions Add custom distraction keywords
GET /api/health Health check + service status

πŸ“ Changelog

v2.6

  • πŸ›‘οΈ General/Strict Mode β€” Two distraction modes at session start:
    • General Mode: Block specific distraction apps (existing behavior)
    • Strict Mode: Only allow listed apps β€” everything else triggers alerts
  • ✍️ Writing/Watching Detection β€” Every 5 minutes, asks if you're writing or watching/reading
    • Writing mode relaxes gaze tracking (looking down at keyboard is expected)
    • Watching mode keeps normal face/gaze metrics active
  • πŸ”’ Mode-aware Motivation Modal β€” Updated promise screen shows mode context
  • πŸ“¦ Backend Mode Support β€” API /api/distractions now accepts mode parameter

v2.4

  • πŸ–₯️ Active App Monitor β€” replaced Screen Capture with pygetwindow window title detection
    • Detects distraction apps (WhatsApp, Instagram, TikTok, Steam, etc.)
    • User-customizable distraction list via setup screen input
    • Confirmation prompt: "Is this for studying?" with per-session whitelisting
    • No screenshots, no screen recording β€” privacy-first approach
  • 😴 Drowsiness Detection β€” eye-closed duration tracking with human-friendly tolerance
    • 3s+ = drowsy, 15s+ = microsleep, 60s+ = deep sleep alarm
    • 3-episode tolerance before first warning, 60s cooldown between alerts
  • πŸ“Ί Video Mode β€” detects video watching (screen focus + no input) and asks for confirmation
  • πŸ”” Smart Alarm β€” every alarm now sends visual notification + push notification alongside sound

v2.3

  • ⏰ Pomodoro System β€” automatic cycles with break duration mapped to session length
  • πŸ”” Browser push notifications (visible even when minimized)
  • ⏱️ Smart alert cooldown (30s between alerts, escalating severity)
  • πŸ“· Webcam fallback β€” auto keyboard/mouse-only mode if webcam disconnects

v2.2

  • πŸ“ Reorganized folder structure (css/, js/, audio/)
  • πŸ”Š Fixed audio alarm (MP3 format, correct paths)
  • 🧠 Fixed metrics logic β€” gauges properly drop when no face detected

v2.1

  • Added floating metrics bar with gauges
  • MediaPipe FaceLandmarker with VIDEO mode
  • PiP alert bar for focus warnings
  • AI analysis button (saves API credits)

v2.0

  • Full web-based tracker with dashboard
  • Focus timeline chart, quiz system

v1.0

  • Standalone Python tracker (main.py)
  • Basic Haar Cascade face/eye detection

πŸ“œ License

AndreasJeno β€” Built for learning and productivity.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors