How to block your computer at night
Blocking the computer overnight — so the small hours stop being screen hours — is something every major OS can half-do and none does cleanly for your own account. Here are the built-in options and where each one gives way.
What is built in
macOS has Downtime inside Screen Time (System Settings → Screen Time). You set a nightly window, and outside your allowed apps the screen is blocked. You can require a Screen Time passcode to get past it.
Windows can schedule allowed hours through Family Safety, but only for a child account in a family group, not for your own.
Linux has no night block by default; you would schedule one with timekpr-next, a cron job, or PAM login-time rules.
The catch
On your own machine you hold the passcode and the administrator rights, so every one of these is one dialog away from off at 1 a.m. — which is precisely when a night block has to hold. A schedule you can dismiss in the moment is a suggestion, not a block.
How One Focus does it
One Focus is built around that 1 a.m. moment. A nightly block covers the screen for the window you set, lifting it early takes the control password, and an optional linked account means the lapse is visible rather than private.
One Focus is a usage limiter, not a tracker that waits for you to stop yourself. You set a daily limit, a nightly block, or a forced Pomodoro rhythm, and it enforces them: when time is up it covers the screen until the window passes. It is built to resist the moment of weakness it exists for — lifting a limit early takes the control password you set, and there is an optional linked account so someone else can see whether you kept to the limits rather than you alone.
It runs on Windows, macOS, Linux and Android, so the rule is the same on every machine you use. It is free and open source under the MIT licence, which for a program that holds this much power over your own computer is the point: you can read exactly what it does before you trust it with that.
Download One Focus — there is a one-line installer and packages for common Linux distributions; pick your platform in the download section.