What if you could get notifications when a task is completed on on your terminal. A small push notification indicating that the command has been executed or a sound would be produced when the terminal has finished a command on Linux. That could end up saving both money and time of yours.
CHECK Top-Right corner …..Cool right ?
We have all faced one thing while working on something both personally and professionally, that is distractions. Distractions everywhere. A programmer sometimes just needs to be in his/her zone, his/her level of peace to work at a peak level . But a certain YouTube video that you got to check out. Or a Facebook comment that you should reply to takes it away…
Suppose you run a task which gonna take some time on the terminal and now you find this amazing 7 minute Ted talk video ( your brain goes : why not) in the meantime that task has already finished and the terminal is waiting for the next step. The uses of this could be endless.
So, you sold ? Cool. Now there might be many possibilities to this like NotiFrye, issuing another command after the it’s completion by using ; But here I will give you the simplest way to achieve this without the bells and whistles. Also I will provide links of all other ways to do this on different distros if this doesn’t work out for any reason.
For Linux 16.04, enter in the terminal:
sudo apt-get install undistract-me
sudo add-apt-repository ppa:undistract-me-packagers/daily sudo apt-get update sudo apt-get install undistract-me
How to make it work
Add this to ~/.bashrc (refer to the footnote for more information)
if ! [ -z "$BASH_VERSION" -o -z "$PS1" -o -n "$last_command_started_cache" ]; then . /usr/share/undistract-me/long-running.bash notify_when_long_running_commands_finish_install fi
Easy enough but one more thing
- 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.
- Undistract-me now runs only when the terminal window is not active which is the true purpose of it. Example : It only shows you the notification when the terminal windows is minimized or not active (at top of the screens)
- Undistract-me doesn’t denote completion notification for small commands like cd or ls which would be quite irritating. Instead **It only shows notification for command longer than 10 seconds only.** To customize this as per your requirement, follow.
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.
- It is possible to disable notifications for certain commands by adding them space-separated to
- There is a way to play sound on notification in it too. Refer here
One last thing
For sound, I prefer to go the extra mile
sudo sed -i 's/blacklist pcspkr/#blacklist pcspkr/g' /etc/modprobe.d/blacklist.conf sudo modprobe pcspkr beep [optional parameters]
foo; spd-say done
Replace foo with whatever command you want to use.
and make your day a little more productive. I am gonna go watch my Ted video now.
Other ways and for other environments :-
Growl for macOS ( untested )
Tilix – Tilix is an advanced GTK3 tiling terminal emulator that follows the Gnome Human Interface Guidelines.And offers notifications when the screen is not active. Available for most distros.
Live in the mix. Subscribe. Share. like. Tell me what else I could write on.
You put commands here to set up the shell for use in your particular environment, or to customize things to your preferences. A common thing to put in
.bashrc are aliases that you want to always be available. We are here putting an alias in the bash file.