Previous Page
PCLinuxOS Magazine
Article List
Next Page

NotiFyre: Notifications When Terminal Tasks Complete

by Paul Arnote (parnote)

Virtually every Linux user, at some point, has tried using the command line to get tasks completed. Some users despise and avoid the command line like the plague. Others, though, discover how powerful and fast the command line actually is, and use it frequently.

Regardless of where you fall in that spectrum of users, there's one thing that is more annoying than anything else. That one thing is running command line programs that take a while to finish, without any progress indicator. A lot of the time, you have no idea whether it is finished, almost finished, just beginning, or even still working.

Wouldn't it be nice if you could go on to do other tasks, and your terminal session would notify you when it was finished? Well, now you can.


You will need to head over to GitHub and download the NotiFyre scripts. Click on the green button that says "Clone/Download" and select to download the ZIP file. Save and extract the ZIP file to a folder of your choosing in your /home folder.

Next, go to the folder where you saved the GitHub files, and copy,, and terminal.png to your /home directory. We'll discuss the locations of these files a bit more a little later.

Now, open up your .bashrc file in a simple text editor. It is in your /home directory, and is a hidden file. Add these two lines to the end of your .bashrc file:

source ~/
source ~/ # as close to end as possible

Lastly, you need to be sure that libnotify and notify-osd are installed on your computer. Open up Synaptic and search for each one. If you find that they are not installed, install them. Alternatively, you can type notify-send "hello" at a command line prompt in a terminal session. If a notification shows up that says "hello", then everything is working. If it doesn't display the notification, reinstall the libnotify and notify-osd programs from Synaptic. On PCLinuxOS, chances are very high that these "dependencies" are already installed. The other "dependency" is paplay. This should already be installed, if you are using a relatively recent release of PCLinuxOS, and haven't removed pulseaudio.

I have a number of scripts that I mostly use as custom actions in Thunar. However, these scripts can also be run by themselves, from the command line. One script I have, called, creates all of the different sizes of JPG files of the magazine cover (and the banner for each issue), from the magazine cover PDF. This is a HUGE timesaver for me, as it's the same process every single month. I simply created the script to utilize ImageMagick commands to create the various sizes of JPG images that we need. While it does the task in fairly short order, it does take a few seconds to complete (usually less than 15 seconds on my computer with a single core Celeron processor to make seven different images from the magazine cover PDF).

So, when you run a command in a terminal session after setting up NotiFyre as directed above, it will display a popup notification to let you know when the command has completed, just like in the upper right corner of the image above.

Tweaking & Tuning

In the script, you have two lines that are supposed to define an alert sound to play when the notification is displayed on the screen. Lines 13 and 26 initially read as:


Well, it's obvious we're not running this on Ubuntu, and this sound file does not exist on my system. So, I tried changing the line to point to a sound file I did have saved on my system.


Even after trying a couple of other sound files I have on my computer, none of them will play as the script has it set to do.

Even though I do have and use pulseaudio, I also tried to use the ALSA command play (as opposed to paplay) in lines 19 and 36 of the script. Still no joy to be had for my ears. The lack of the ability to play a sound file is far from a deal breaker, at least for me, anyway.

You can imagine how startled I was when, all of a sudden, I heard the sound of a Bic pen click. At first, it really did startle me. It appears that the sound does work and play, but only sometimes, and with certain commands. Your mileage may vary.

On my computer, I really dislike having bash scripts scattered all around my hard drive. I especially hate having bash scripts in my top level /home directory. It really breaks up how I have my files organized. Instead, I prefer to have all of my scripts placed into my ~/Scripts directory. This directory has been placed into my PATH statement so that my scripts can just be executed from anywhere on my system without me having to provide a complete path and filename. Instead, I just have to provide the name of the script … and any extra parameters it requires.

So, when I place the necessary scripts into my ~/Scripts directory, and alter the .bashrc file additions to point to the new locations, nothing I've been able to do will allow the terminal.png icon file to be displayed. The results are in the image above. The scripts still work, though, and just like with the inability to play a sound, not displaying an icon is definitely not a deal breaker, at least for me. Granted, I didn't spend an inordinate amount of time trying to get it to work, either, so your mileage may vary.

Most of the "script magic" occurs in the following lines (which appears all on one line in the script):

[ $(($(date +%s) - start)) -le 0 ] || notify-send "Terminal in ${p[-2]}/${p[-1]} \$" "$commandx completed in $(($(date +%s) - start)) seconds" -i ~/Scripts/terminal.png -t 50

I say "lines" because this line appears twice, once on line 17, then again on line 35. There are a few additional areas available for customization in these lines.

-le 0 can be changed to any number you want. This is the number of seconds before NotiFyre will display the notification. That is, by default, commands that take longer than zero (0) seconds to complete trigger the NotiFyre notification. You can change this to two seconds, three seconds, five seconds, 15 seconds, 30 seconds, or any other number of seconds you want.

-i ~/Scripts/terminal.png. In line 17 of the script, this appears (by default) as -i utilities-terminal. In line 35 of the script, this appears as -i ~/terminal.png. You can change this to point to any icon on your computer by providing the path and filename of that icon file.

-t 50 specifies the timeout time (in milliseconds) for notify-send to display the notification. However, due to a bug (a design decision by its developer, which is by most accounts still a bug) in the notify-send command, the timeout parameter is ignored, yielding to the system wide setting for the amount of time to display the notification on your computer. Trust me on this. I tried changing it to 500 and even 5000, with absolutely no difference in the amount of time that the notification was displayed on the screen.


If you use fish as your shell (instead of bash), there are also instructions on the NotiFyre GitHub page on how to set NotiFyre up with the fish shell. Most users make use of the bash shell (the default in PCLinuxOS), so I'll leave the fish shell instructions as something fish shell users can look at on their own.

If you spend any time at all on the command line, NotiFyre is an excellent addition to your system. There is nothing more bewildering and frustrating than sitting there, waiting for a command to complete -- especially those commands that don't update their progress or status. With NotiFyre, you can go on to do other tasks, and receive a notification when the terminal command has completed.

Another nice thing about NotiFyre is that there is nothing to install from outside the official PCLinuxOS repository. NotiFyre exists as nothing more than a couple of scripts. Thus, using NotiFyre does not break the PCLinuxOS rule of not installing programs from outside the official repository.

Previous Page              Top              Next Page