Distraction-free writing with a terminal timer and Ubuntu notifications

21 July 2017


flickr photo by Franz Ferdinand Photography shared under a Creative Commons (BY-NC) license

Have you ever struggled to focus on your technical writing? Even though I enjoy writing research papers, I too can sometimes find it difficult to focus on technical writing. So, what should you do when you mind is wandering and you have to finish some content by a deadline? Of course, set a timer!

Since I prepare papers and presentations using Neovim in a terminal window running tmux, I recently looked for a timer that I could also run at the command prompt. Thankfully, I discovered this post about the termdown program.

If you check the documentation for termdown, you will notice that it is a Python program that you install by typing the following command in your terminal window: pip install termdown. This program has a lot of options that you can learn more about by reading its documentation. For my purposes, I wanted the countdown timer to run for 30 minutes and then to trigger an Ubuntu notification when it expired.

Is it possible to achieve this goal with a single command in your terminal! Here it is:

termdown 30m -T "Distraction-Free Writing" --no-figlet && notify-send "Distraction-Free Writing" \ "Task Finished\!"

The first parameter specifies the number of minutes for which I will be writing and the second gives a title to the countdown display. Using the --no-figlet parameter ensures that termdown shows a minimal countdown timer. Finally, when the timer completes, the call to notify-send will trigger an Ubuntu notification with "Distraction-Free Writing" as the title and "Task Finished!" as the message.

Do you have any questions about this technique? Or, do you have some tips for distraction-free writing? If you do, then I hope that you will contact me to share some of your ideas.

Enjoy this post? If so, please read, Hitchhiker's need free vehicles!, a recently updated article.

Categories

Like my work? Support it!