How to force a new Notification in notify-osd to show up without waiting for the earlier one to exit?

Posted by Nirmik on Ask Ubuntu See other posts from Ask Ubuntu or by Nirmik
Published on 2012-07-09T18:01:58Z Indexed on 2012/07/09 21:23 UTC
Read the original article Hit count: 360

I have made a script(and a .desktop shortcut leading to this script) for starting and stoping xampp...

It checks the status of xampp and accordingly either starts or stops xampp.

Now i have assigned a notification as soon as the script is started to display "Starting xampp..." or "Stopping xampp..." and then when xampp is started or stopped,it displays "Xampp started..." or "Xampp stopped..."

I've used notify-send to show notification as seen in the script below

Now the thing is that here,the second notification waits for the 1st one to disappear and then pops up even if xampp has started/stopped.

I want the new notification to appear immediately by forcing the earlier one to exit before the completion of its life-cycle.

This can be seen to take plce when you activate/deactivate wireless/networking immediately...

For example the "Wireless enabled" comes up on selecting enable wireless and if you immediately select disable wireless,the "Wireless disabled" notification comes up without waiting for "Wireless enabled" notification to complete its life-cycle.

So how do i achieve this?

#!/bin/sh

SERVICE='proftpd'

if ps ax | grep -v grep | grep $SERVICE > /dev/null

then

notify-send -i /opt/lampp/htdocs/xampp/img/logo-small.gif "Stopping XAMPP..." && gksudo /opt/lampp/lampp stop && notify-send -i /opt/lampp/htdocs/xampp/img/logo- small.gif "XAMPP Stoped."

else

notify-send -i /opt/lampp/htdocs/xampp/img/logo-small.gif "Starting XAMPP..." && gksudo /opt/lampp/lampp start && notify-send -i /opt/lampp/htdocs/xampp/img/logo-small.gif "XAMPP Started."

fi

On the man page for notify-send I found --urgency=LEVEL or -u where levels are low, normal, critical.

Is this of any use? making it critical?

Also I tried it with the command- notify-send -u=critical"Testing" but that dint work...it gives the error- Unknown urgency criticalTesting specified. Known urgency levels: low, normal, critical.

or if I give the command notify-send -u=LOW"Testing" it gives me error missing argument to -u

Any relation??

© Ask Ubuntu or respective owner

Related posts about notification

Related posts about notify-osd