How can I block nearly every site for short periods of time to improve my focus on work?

If you want to block all sites except for example.com and work.com, the following is one way to add a 90 minute focus session.

pluck + allow+ example.com
pluck + allow+ work.com
pluck + when now+90m block+ text

As long as example.com and work.com are already in your configuration, and have elevated priority via allow+, then they alone will be unaffected by the elevated priority rule block+ text.

(To gain a better understanding of how elevated priority works, see priority modifiers.)

Does this work for applications as well?

Yes, you can block distracting desktop applications as well as distracting sites. The same principles as in the previous example apply.

To block all programs and sites and focus only on VS Code for 90 minutes, the following will work.

pluck + allow+ program code  # unix systems
pluck + allow+ program code.exe  # windows systems
pluck + when now+90m block+ otherwise

Making web browsers work during block+ otherwise sessions

The above example demonstrates how to use a coding app, but using a web browser during a block+ otherwise session requires extra configuring.

You need to configure the following:

  • an unblock rule for the browser
  • an allow rule for the system’s network name resolution manager
  • an allow rule for each site you intend to use

Windows

pluck + allow+ pluckeye.net
pluck + allow+ program svchost.exe
pluck + unblock+ otherwise program brave.exe

MacOS

(Tested on Sonoma)

pluck + allow+ pluckeye.net

That’s it, actually. One of the rare times where MacOS requires less configuring than Windows or Linux.

Linux

(Tested on Mint 22)

pluck + allow+ pluckeye.net
pluck + allow+ program systemd-resolved
pluck + unblock+ otherwise program chrome

What if I want to automate it with a script?

If you’d like a ready-made script, see focus.sh.

TODO: write a similar script for Windows.


Last updated: 2024-09-09