Get the highlights in your inbox every week.
Improve your focus and productivity with this Python tool | Opensource.com
Improve your focus and productivity with this Python tool
Concentration offers a quick way to filter out distractions and focus on coding.
How do you stay focused while working?
Limiting distractions helps you focus on your work so you can increase productivity. Prioritizing your tasks, especially when you have too much on your plate, is one way to help you focus on the most important or high-attention things on your list.
Another way to focus on tasks is Python Concentration, a helpful tool I found a few years ago for improving my time-management skills and increasing my focus. It is a simple Python 3 console utility that reduces distractions by blocking things like gaming, news sites, YouTube, and Netflix when I need to pay attention to work, but it also allows me to take timed breaks when I need them.
Getting started with Concentration
Concentration uses pip, the Python Package Installer, for installation. If needed, install pip with:
$ dnf install pip
$ yum install pip
$ apt install pip
Then use pip to install Concentration with either:
$ pip3 install concentration
or, if pip is already set to use Python 3:
You can install Concentration as a regular user or as a privileged user (root).
$ pip install concentration
Block distracting sites
Concentration uses your
/etc/hosts file as the mechanism to block sites. It also comes with a default list of blocked sites, called
DISTRACTORS. You can check the list with:
$ sudo concentration blocked
You can add sites to this list under
DISTRACTORS in your
settings.py file. The path will depend on your installation (mine is
If you're on a site you want to block, enter:
$ sudo concentration improve
Take a break
It may sound counterintuitive, but taking short breaks during your workday can help you focus on your work better. Concentration allows you to take time-limited breaks so you can clear your head while helping you get back on task when your break time is over.
To take a short, five-minute break, which is counted in seconds:
$ sudo concentration break
To take a long, 60-minute break:
$ sudo concentration break -m 60
To pause Concentration so you can access all sites (like when you're not at work):
$ sudo concentration lose
Give it a try
Concentration is a simple, very useful tool that will help you focus throughout your day and take breaks to relax when you need them.
If you think this tweak is interesting, give it a try and report what you think in the comments below. And, if you know of other cool tricks to improve your focus and avoid distractions, please share them in the comments, as well.