Blocker allows you to block your desired websites so that you can stay focused.
Browser extensions that are currently available surely do a great job, but what about when you have multiple browsers and multiple profiles? It can be a pain to install extensions over multiple browsers and multiple profiles. Similarly, you can easily bypass almost all extension blocks as soon as you open an incognito window. Furthermore, most of the extensions keep on notifying you to get a premium. Blocker helps you to solve this problem.
go install github.com/CoderParth/blocker@latest
Note: The program requires admin-level permission.
- macOS & Linux: Use
sudowhen running commands. - Windows: Run your terminal (Command Prompt or PowerShell) as Administrator.
Enter only the name of the website (e.g., youtube, not youtube.com).
This guide helps you set up the PATH for Go tools installed with go install so they can be run from anywhere.
-
Edit your shell configuration:
-
For Bash (Linux/macOS):
nano ~/.bashrc # Linux nano ~/.bash_profile # macOS
-
For Zsh (Linux/macOS):
nano ~/.zshrc
-
-
Add this line at the end of the file:
export PATH=$PATH:$HOME/go/bin
-
Apply the changes:
source ~/.bashrc # For Linux source ~/.bash_profile # For macOS source ~/.zshrc # For Zsh
-
Verify:
sudo blocker help
-
Edit Environment Variables:
-
Open Start Menu > Environment Variables > Edit the system environment variables.
-
Under User variables, find and edit the
Pathvariable. -
Add this path:
C:\Users\<Username>\go\binReplace
<Username>with your actual Windows username or the custom Go installation path.
-
-
Verify:
blocker list
sudo blocker add <website-name> # Adds the given website to the blocked list.
sudo blocker remove <website-name> # Removes the given website from the blocked list.
sudo blocker list # lists all the enabled and disabled websites present in the blocked list.
sudo blocker disable <website-name>
# If a website is enabled, this command disables the given website from blocking.
sudo blocker enable <website-name> # If disabled, it enables the given website for blocking.
First: Run your terminal as an administrator.
blocker add <website-name>
blocker remove <website-name>
blocker list
blocker disable <website-name>
blocker enable <website-name>
Although, at this moment, enable and disable are similar to add and remove, future features such as time-based blocking, scheduling a block, focus sessions, etc. will be built on top of the enable and disable commands.