I’m running linux mint 12 (package base is Ubuntu Oneiric). I essentially want to have a script run every minute or so which does some stuff, and will give me true or false. If true I want a pop-up notification. I’m considering notify-send as this appears to do what I want to do, in a nice unobtrusive way. There are a couple of problems I’ve encountered though.
I don’t want the notifications to stack up. If it returns true and I do not attend to it, it will return true the next time and current this causes the notifications to stack up. Is there any way to check if the notification has already been issued, and thus not send another one (perhaps send the notification again after 10 minutes in case I didn’t notice it the first time). The job is currently set up as a cronjob, but I can think of a ‘hacky’ way of getting this functionality if I was to have the script running constantly and using sleep, but I’d rather avoid that root.
Additionally, how can I make it so that when I click the notification it will launch an application/script of my choosing? This appears to be possible as Dropbox etc issue notifications that behave in this manor, but I’m not sure if that is done through notify-send or not.
Anything to point me in the right direction would be great. Thanks.
From a quick perusal of the libnotify API, it does not appear that the daemon returns anything to the client identifying an outstanding notification. In other words, it’s a “fire and forget” API — once you’ve sent the request to display a popup you have no way to determine if the popup is still there. I’m afraid you’re out of luck, at least with notify-send.