Inspiration

Last week, I lost 4 hours to chess openings. Not playing chess, just studying openings I'll never use. I realized my browser is a attention trap that no amount of willpower can resist. Existing "productivity tools" are passive and easy to ignore.

So I built an enforcer. A digital nanny with teeth.

What It Does

Focus Klaxon is a CLI daemon that watches your active windows. When you open a distraction site (Discord, Chess.com, YouTube, etc.):

  1. Warning Phase: Popup notification gives you 5 seconds to close it yourself
  2. Mouse of Doom: If you ignore the warning, your cursor goes absolutely berserk—violent shakes, screen dashes, chaotic circles
  3. Nuclear Option: Still there? It closes the tab FOR you and opens your focus page

It also:

  • Auto-logs every distraction event (JSON + dashboard)
  • Generates personalized haikus based on site, time of day, and repeat offenses
  • Shows session reports with top triggers and improvement tracking
  • Has a "repeat offender nudge mode" that auto-types a warning in your Google Doc: "Focus check: return to work now. You got distracted 3 times in the past hour (chess.com)."
  • Displays a glitch-effect "RADIOACTIVE MODE" on your dashboard during punishment phases

How I Built It

  • Python CLI (argparse, colorama) — +5 bonus points for CLI-only
  • pygetwindow + pyautogui — active window detection, mouse control, window closing
  • AppleScript (macOS) — browser URL detection for Safari, Chrome, Opera, Brave, Arc
  • JSON — local distraction log + session history
  • HTML/CSS/JS on GitHub Pages — focus dashboard with glitch effects, event feed, localStorage tracking
  • Subprocess + ctypes — cross-platform popups and window management

Challenges I Faced

  • Cross-browser URL detection on macOS: Different browsers format window titles differently. Safari/Opera were especially tricky—had to use AppleScript JXA to extract active tab URLs.
  • Non-blocking popups: Standard OS dialog boxes block execution. Built custom notification flow to maintain countdown timing.
  • Graceful escalation state machine: Ensuring the three-strike system advances correctly (popup → mouse chaos → force close) without infinite loops or timing issues.
  • Making haikus actually good: Generated robot haikus were cringe. Iterated multiple tone passes to get natural, wry poetry instead of forced tech-cringe.

What I Learned

  • Python can control your entire desktop environment (responsibly, with user consent)
  • Window title scraping is surprisingly complex across browsers
  • People laugh uncontrollably when a cursor starts freaking out
  • A little personality (haikus, glitch mode, "Mouse of Doom" branding) makes CLI tools memorable

Why It's CLI-Only (+5 Points)

Entirely text-based menu with colored output. No GUI framework. Runs in any terminal. Watcher daemon runs in background while you work.

The Vibe

This isn't a productivity app. It's a digital accountability partner with anger issues. Judges remember the tool that force-closed my Chess.com tab while my mouse was having a seizure.

Built With

Share this project:

Updates