r/PythonProjects2 • u/Satyamlovessyrup • Jun 15 '26
Built a distraction blocker for Windows in Python — blocks sites at the hosts file level, packaged as a .exe with UAC elevation [Feedback Welcome]
Hey everyone! I built a desktop app called FocusMode — a Windows distraction blocker built with Python and CustomTkinter.
I got tired of browser extensions that are too easy to disable mid-session, so I went lower-level: it edits the system hosts file directly to block distracting sites. No way to bypass it without admin rights.
What it does:
Blocks sites by redirecting them to
127.0.0.1in the hosts fileClean GUI built with CustomTkinter
Packaged as a standalone
.exeusing PyInstaller with UAC elevation (so it can write to the hosts file without you manually running as admin)Released as v1.0.0 on GitHub
Some things I learned building this:
Handling UAC elevation properly with PyInstaller is trickier than it looks — had to use a manifest file to request admin rights at launch
CustomTkinter is genuinely great for making Python desktop apps that don't look like they're from 2003
Packaging Python apps to
.exewith all dependencies bundled takes some trial and error
GitHub: https://github.com/Purple2Blue/NO-DISTRACTION/releases/tag/v1.2.0
This is one of my first proper desktop apps so I'd love honest feedback — on the code, the UX, or anything you'd add. Would you actually use something like this?
Built with: Python, CustomTkinter, PyInstaller
2
u/Jay6_9 Jun 15 '26
Make sure you somehow flush the DNS cache. I'm sure I had to do that when I add or remove an entry to my HostMan setup.