DEV Community

Cover image for I Built an Open-Source macOS Screen-Cleaning & Pet-Lock Utility in 3 Hours with AI
codesugar lin
codesugar lin

Posted on

I Built an Open-Source macOS Screen-Cleaning & Pet-Lock Utility in 3 Hours with AI

The Problem Nobody Talks About

Here's a dumb problem that bugged me for years: I couldn't clean my MacBook screen properly.

Every time I grabbed a cloth to wipe the display, I'd accidentally brush the keyboard or trackpad. The screen would wake up, show my wallpaper, and suddenly I couldn't tell where the smudges were anymore. I'd end up "blind-wiping" and hoping for the best. Shutting down the whole machine just to wipe a screen felt absurd.

Then there was the cat problem. I saw complaints in App Store reviews: people watching videos on their Macs, and their cats would walk across the keyboard — pausing the video, switching tabs, opening Spotlight. Classic cat behavior, zero good solutions.

So I built CleanMyScreen.

What It Does

Three modes, one tiny app:

Mode What Stays Visible What Gets Locked
Cleaning Pure-black overlay on all displays Keyboard + pointer
Pet / Kid Your current video or app Keyboard + trackpad
Selective Your desktop Any combination you choose

Every session has a 3-second countdown before locking, an optional auto-timeout, and a 3-second Escape hold as an emergency unlock.

The Stack

  • SwiftUI for the UI
  • AppKit for window management and overlays
  • Core Graphics for display brightness control
  • IOKit for low-level HID device seizing (this is how you actually lock a specific trackpad vs. keyboard at the hardware level)

No Electron. No web views. No accounts. No telemetry. No network calls at all. The app literally cannot phone home.

Built in 3 Hours with Codex

Here's the part that still blows my mind.

I'd had this idea sitting in my backlog for over a year. It wasn't complicated conceptually, but between work and other projects, I never prioritized it — partly because the monetization path was unclear for something this simple.

Then I had some Codex credits about to reset, so I thought: why not just ship it?

The entire functional app was built in under 3 hours. Codex handled the SwiftUI views, the IOKit device enumeration, the overlay window management, and the brightness control logic. I spent the remaining time fine-tuning UX details — countdown animations, the emergency unlock flow, making sure device seizing was properly cleaned up on session end.

This is exactly the kind of project where AI coding tools shine: the requirements are clear, the scope is tight, and the individual pieces (IOKit APIs, CGDisplay functions) are well-documented but tedious to wire together manually.

Try It / Contribute

CleanMyScreen is MIT-licensed and works on both Apple Silicon and Intel Macs.

🔗 GitHub: github.com/opensource-works/CleanMyMac

You can build from source with just the Swift command-line tools — no Xcode project needed:

./Scripts/run-tests.sh
./Scripts/build-app.sh
open dist/CleanMyScreen.app
Enter fullscreen mode Exit fullscreen mode

If you have ideas, bugs, or feature requests, open an issue. I'd especially love input on:

  • External display brightness control (it's best-effort right now due to macOS API fragmentation)
  • Additional use cases for the Selective mode
  • Localization — the app is English-only for now

Top comments (0)