1

I would like to always receive a visual notification when a process has finished in a terminal window. Example of such a process:

youtube-dl -cit --extract-audio --audio-format mp3 https://www.youtube.com/....
orschiro
  • 12,987
  • 16
  • 82
  • 157
  • 1
    Would something like this work for you? `sleep 30 ; xmessage -center "Sleep 30 Done"` Where you substitute `sleep 30` with your command and enter the text you like between the double quotes? Basically, it's two commands executed in sequence. That's what the `; `stands for: it separates two commands. – jawtheshark Aug 22 '16 at 15:23
  • Thank you! I would prefer [this type](https://encrypted-tbn2.gstatic.com/images?q=tbn:ANd9GcQ4jCOMhNcBmW1MCYyPhH2O5ime5npPB4bHpB8gPpKEfCbpn17b) of notification, however. – orschiro Aug 22 '16 at 15:27
  • Probably doable with some DBus magic... Let's see if Google yields anything... – jawtheshark Aug 22 '16 at 15:34
  • What process? A specific one that you've started? *Any* process running on the system? Any process started by your user? Also, should the notification depend on whether the process finished successfully or failed or was stopped? Please [edit] your question and clarify. – terdon Aug 22 '16 at 15:40
  • Didn't you ask a related question some months ago? That time it was about making a notification like the one some other OS (Elementary) provided and you were pointed to `alert` in Ubuntu's .bashrc. – DK Bose Aug 22 '16 at 15:41
  • Indeed, thanks for the reminder @DKBose! But this time I don't want this to happen manually by using `alert` but make this the default feature. – orschiro Aug 22 '16 at 15:42
  • shortest way I know is alias in .bashrc `alias a='notify-send "Completed"` execution `youtube-dl ;a` –  Aug 22 '16 at 15:47
  • Can this be set-up so that I don't even have to type the alias `a` before a command? – orschiro Aug 22 '16 at 15:50
  • I think that with [undistract-me](http://askubuntu.com/a/617735/403828) I found the perfect solution for my scenario! – orschiro Aug 23 '16 at 04:42

1 Answers1

2

Use this:

yourlongrunningcommand ; notify-send "Yay! We're done!  Off to the bar!"

To understand the command:

  • The ; denoted sequential execution. First execute yourlongrunningcommand and when done, execute the next command... which is
  • notify-send, which is nothing more than the type of notification you wanted as per our comment exchange

I just googled to know that second part. I found this on askubuntu.com.

jawtheshark
  • 2,482
  • 1
  • 17
  • 21