Author: Alex Waisman
Monitor your focus and detect digital distractions in real-time.
- Person Detection: Tracks when you're away from your desk using YOLO AI.
- Phone Detection: Alerts when a cell phone is detected.
- App Monitoring: Logs when you open distracting apps (Netflix, YouTube, Discord, etc.).
- Motion Fallback: Detects movement even if AI misses you.
- Session Reports: HTML report with timestamped event log.
pip install -r requirements.txtStart the app:
python focus_frame.pyHotkeys:
Ctrl+Alt+Enter– Start monitoringCtrl+Alt+Backspace– Stop monitoring & generate report
After launching, type p and press Enter to configure Pomodoro:
>>> FocusFrame: LOADING AI MODEL...
============================================================
FocusFrame - READY
============================================================
HOTKEYS:
[Ctrl] + [Alt] + [Enter] --> START
[Ctrl] + [Alt] + [Backspace] --> STOP
------------------------------------------------------------
POMODORO MODE (optional):
Type 'p' + Enter to configure Pomodoro timer
Example: 25 min work, 5 min break, 4 cycles
============================================================
--------------------------------------------------
POMODORO SETUP
--------------------------------------------------
Work duration (minutes): 25
Break duration (minutes): 5
Number of cycles: 4
✓ Pomodoro configured: 25m work / 5m break x 4 cycles
Press [Ctrl]+[Alt]+[Enter] to start Pomodoro session!
--------------------------------------------------
Then press Ctrl+Alt+Enter to start your Pomodoro session with automatic work/break cycles.
python focus_frame.py --motion-threshold 1200 --absence-time 3 --presence-threshold 1Available flags:
--motion-threshold(default: 1500) – Lower = more sensitive to movement--absence-time(default: 5.0) – Seconds before marking away--presence-threshold(default: 2) – Score needed to register as present--decrement-interval(default: 0.25) – Seconds between score drops
- Presence Smoothing: Uses a score system (0-5) that increments on detection/motion and decrements slowly.
- Away Detection: Logs "User Away from Desk" when score reaches 0 and timeout elapses.
- Return Detection: Logs "User returned" when score crosses the presence threshold. (needs fixing!)
- Event Logging: All events (phone, apps, away/return) logged to HTML report.
- Python 3.8+
- OpenCV, YOLO, pynput, pygetwindow
- Webcam
See requirements.txt for full dependency list.
MIT License