Undistract-me is a simple tool that notifies you when a command you run in a terminal which takes longer than ten seconds to finish is done.

Besides letting you know that the command has finished running, the notifications sent by Undistract-me display the command you ran (useful if you run multiple commands in the same time) and the number of seconds it took for the command to finish.

This can be useful e.g. when you start to compile something and then you switch to some other window to read your emails or whatever and get distracted and forget about the command you ran: Undistract-me displays a notification when the command / job you ran in the terminal is done so you can go back to the terminal and see the final result, etc.

command completed notification


There is another way of doing this: using an "alert", about which we've written a while back (or a simple notify-send command added after the actual command you want to run) - which by the way is now available by default in Ubuntu, simply use "some command; alert". However, using the "alert" alias, you must add "alert" at the end of each command you want to be notified for and you may forget to do this sometimes, while using Undistract-me, this is not required and any command that takes more than 10 seconds to complete will trigger a notification.

Undistract-me only works with Bash (default in Ubuntu) and should display notifications on any desktop environment - here's a GNOME Shell screenshot:

undistract-me notification GNOME Shell


By default, Undistract-me notifies you when any command that takes longer than 10 seconds to complete is done, so you don't get flooded with notifications for simple commands like "ls" or "cd", but you can change this: edit the /usr/share/undistract-me/long-running.bash file as root and changing the "LONG_RUNNING_COMMAND_TIMEOUT=" variable value from 10 to whatever you want.

Update: in a later release, Undistract-me  has added a "LONG_RUNNING_COMMAND_CUSTOM" variable which you can use to send a command other than "notify-send". Also, the notifications are now displayed only if the window isn't active.


Install Undistract-me in Ubuntu


terminal command completed notification


Undistract-me is available in the official Ubuntu 13.04 repositories so to install it, simply search for it in Ubuntu Software Center or install "undistract-me" via command line.

To install Undistract-me in Ubuntu 12.10 or 12.04, use the following commands:
sudo add-apt-repository ppa:undistract-me-packagers/daily
sudo apt-get update
sudo apt-get install undistract-me

Arch Linux users can get Undistract-me via AUR.

For other Linux distributions, you can grab Undistract-me from Launchpad (instructions HERE).


To get Undistract-me to work, you must enable "Run command as a login shell" so open the terminal you're using and:
  • for GNOME Terminal: select Edit > Profile Preferences and on the Title and Command tab, check the "Run command as login shell;
  • for Guake Terminal, right click in a terminal, select "Preferences" and on the General tab, check the "Run command as a login shell" box.
terminal Run command as a login shell

If you're using a different terminal, look through its preferences for the "Run command as a login shell" option and make sure it's checked.

Once you do this, restart the terminal (make sure you close all open terminal windows) and you're done.

If you want to test it, run a command that takes longer than 10 seconds to complete or you can simply run "sleep 11" in a terminal and in 11 seconds, you should get a notification like the ones you can see in the two screenshots in this article.

Report any bugs you may find @ Launchpad.

0 comments:

Post a Comment

 
Top