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.

woman on laptop sitting at the window
Image credits : 

CC BY 3.0 US Mapbox Uncharted ERG

x

Subscribe now

Get the highlights in your inbox every week.

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.

concentration.gif

Concentration

(Timothy Crosley, CC BY-SA 4.0)

Getting started with Concentration

Concentration uses pip, the Python Package Installer, for installation. If needed, install pip with:

  • Fedora: $ dnf install pip
  • RHEL/CentOS: $ yum install pip
  • Debian: $ apt install pip

Then use pip to install Concentration with either:

$ pip3 install concentration

or, if pip is already set to use Python 3:

$ pip install concentration

You can install Concentration as a regular user or as a privileged user (root).

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 /usr/local/lib/python3.8/site-packages/concentration/settings.py).

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.

Business woman on laptop sitting in front of window

Whether you need help to stay focused, maintain timeliness, or find shortcuts to avoid repetition, these Linux tools have you covered.
Person drinking a hot drink at the computer

Get organized and accomplish more with these five productivity apps for the Elementary Linux desktop.
6 open source tools for staying organized eBook

Download our new eBook to learn about 6 open source tools that will help you maximize your productivity.
Person programming on a laptop on a building

A nocturnal work schedule is the key to creativity and productivity for many open source programmers.
Woman programming

Share your favorite music for coding by taking our poll. If none of these artists represent music...

Topics

About the author

Sudeshna is from Kolkata and currently working for the Red Hat Middleware team in Pune, India. She loves to explore different open source projects and programs. She started contributing to Open Source a couple of years back as an Hacktober Participant since then she has been an avid blogger at Dzone on Python and Data Science. She enjoys her free time stargazing and loves continental cuisine. She is an RHCSA and is working her way to RHCA.
Sudeshna Sur - Sudeshna is from Kolkata and currently working for the Red Hat Middleware team in Pune, India. She loves to explore different open source projects and programs. She started contributing to Open Source a couple of years back as an Hacktober Participant since then she has been an avid blogger at Dzone on Python and Data Science. She enjoys her free time stargazing and loves continental cuisine. She is an RHCSA and is working her way to RHCA.