Get Notification When A Terminal Task Is Done
I prefer to use Terminal a lot to do stuffs, and I am sure most of you do. When I run a command that takes long time to complete, I check the Terminal constantly if the task is completed or not. Say for example, when I update my Arch system, I constantly check Terminal whether the command is completed or not. Not anymore. Today, I have stumbled upon an useful script called NotiFyre that notifies you with a pop up window when a Terminal activity is done.
In this brief guide let us see how to use this script.
Get Notification When A Terminal Task Is Done Using NotiFyre
I tested it in Ubuntu 16.04 LTS desktop. Make sure you have installed the following prerequisites.
sudo apt-get install notify-osd pulseaudio-utils libnotify-bin
Generally, these prerequisites will be installed by default on most Linux distributions. To check whether if notify-osd is working or not by running the following command from your Terminal.
The above command will open up a pop window that displays a message “hello”. If no message pops up, it means notify-osd is not working. Try to reinstall the above prerequisites as shown below.
sudo apt-get --reinstall install libnotify-bin notify-osd
Now run the notify-send command and see if the message pops up.
Next, download or git clone the NotiFyre script from its GitHub page. The link is attached at the end of this guide.
Then, open the NotiFyre folder. Copy the following files and place them in your HOME folder if you use BASH shell.
Then, edit bashrc file:
sudo vi ~/.bashrc
Add the following lines at the end.
source ~/notifyre.sh source ~/bash-preexec.sh
Save and close the file. Then, run the following command to take effect the saved changes.
Now, run any task on your Terminal, you will be notified each time when a command is done.
Cool, isn’t it?
If you use Fish shell, you need to place the terminal.png, prompt_pwd.fish, notifyre.fish and nf.fish files in your ~/.config/fish/functions/ folder. Then edit your functions/fish_prompt.fish file and add the following lines just before the end.
function fish_prompt ... eval (notifyre) end
You can change the notification sound (tone) by editing this line in the notifyre.sh file.
Also, you can change notification interval time by editing the following line in notifyre.sh file.
[ $(($(date +%s) - start)) -le 0 ] || notify-send "Terminal process" "$(echo $@) completed in $(($(date +%s) - start)) seconds" -i ~/terminal.png -t 2000
Now, you don’t have to constantly check the Terminal to know whether a task is finished or not. Forget about it and do other tasks. NotiFyre will notify you when task is done.
Thanks for stopping by!
Help us to help you:
- Subscribe to our Email Newsletter : Sign Up Now
- Support OSTechNix : Donate Via PayPal
- Download free E-Books and Videos : OSTechNix on TradePub
- Connect with us: Facebook | Twitter | Google Plus | LinkedIn | RSS feeds
Have a Good day!!