Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I'm wondering if it's possible to integrate NotifyOSD with gnome-terminal.

I'd like if NotifyOSD warned me if there was new output in gnome-terminal (if the window isn't focused). As soon as a new output is printed and the window isn't focused, it'd warn me through notify-osd (1 time only). For instance:

gnome-terminal notifications with notify-osd

Is this possible?

Thanks.

share|improve this question
    
Please be more concrete. Because I would find it really really annoying if ping notifies me on every new output. If you just want a result notification, try <command>; notify-send $(if [ $? -eq 0 ]; then echo Success; else echo Failure; fi) –  dAnjou Jun 19 '11 at 1:03
    
I think it was pretty explicit. I want it to warn me if a new output is printed on a terminal which is not focused (1 time only). –  goncalossilva Jun 19 '11 at 2:30
1  
As a workaround you could use the KDE konsole, which has that functionality. It works well in Gnome/Unity. –  elmicha Jun 19 '11 at 12:50
    
I'd rather have that feature in gnome-terminal itself... anyway, thanks for the tip! –  goncalossilva Jun 19 '11 at 15:26
add comment

1 Answer

Dustin Kirkland, Core Developer of the Ubuntu Server posted something very interesting on his blog: an alias you can add to your .bashrc file to get notified when a job you run in a terminal is done.

Setting everything up

  1. To use it, simply edit your ~/.bashrc file:

gedit ~/.bashrc

and paste this at the end of the file:

alias alert_helper='history|tail -n1|sed -e "s/^\s*[0-9]\+\s*//" -e "s/;\s*alert$//"'
alias alert='notify-send -i /usr/share/icons/gnome/32x32/apps/gnome-terminal.png "[$?] $(alert_helper)"'
  1. Now source your .bashrc:

source ~/.bashrc

Try it out

To get notified when a job you run in a terminal is done, add "; alert" at the end of a command (without the quotes).

As a test command you can run:

sleep 20; alert

Example: If you want to get notified when you compile some program, run the "make" command like this:

make; alert

Many thanks to Dustin Kirkland for the alias!

share|improve this answer
    
Thanks for the tip! Would it be possible to make it the default behavior? I'd like to be notified of all finished jobs when the terminal isn't focused. –  goncalossilva Nov 16 '11 at 1:27
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.