Often we run some command in terminal which takes a hell of a lot of time to finish. Then, we wish we could do something else while the command runs but get a notification when it's done.
Getting this notification is quite easy.
Just run your command in the following manner to achieve this:
where,
your-main-command ==> the command that you are running
notification-command ==> command used for notifying
So, your final command should look something like this:
Now, what if you wanted the notification to show up after every command you type, without having to type the notification as well. To do this, install autokey first.
Getting this notification is quite easy.
Just run your command in the following manner to achieve this:
your-main-command; notification-command &
where,
your-main-command ==> the command that you are running
notification-command ==> command used for notifying
Various Notification Commands
You can use any of these commands for notification:
notify-send "Command finished running." #use on Ubuntu/Mint xmessage "Command finished running." #can be used on all Linux distros
So, your final command should look something like this:
your-command; notify-send "Command finished running." &
Automating for every command
Now, what if you wanted the notification to show up after every command you type, without having to type the notification as well. To do this, install autokey first.
sudo apt-get install autokey-gtkAutokey is a software for mapping different actions to different keystrokes. It's very powerful. Now, open Autokey and follow these steps:
- Here, define a new "phrase". Give it some name. In the big text-box on the right side, enter the following text:
; notify-send "Job finished!" &
IMP: Note that in the above phrase text, there is a newline after the first line. Be sure to include that. - Set the "hotkey" as alt+center.
- Assign the "Window Filter" as
.*(guake)|(Terminal).*
NOTE: If you're some other terminal than Terminal or guake, then add its name in the window filter.