Just to write this down somewhere before I forget it again...
It's easy to make those Gnome pop-up notifications from the command line
notify-send 'Venture Bros' 'Go Team Venture!'
or Perl
perl -MGtk2::Notify=-init,Venture -e 'Gtk2::Notify->new( "Venture Bros", "Go Team Venture!")->show'
or Python
python -c 'import pynotify; pynotify.init("Venture"); pynotify.Notification("Venture Bros", "Go Team Venture!").show()'
All three of these will give
for a few seconds.
Apparently, you can do it from Ruby too, but I haven't got that installed.
ETA (16 Dec 2011): An anonymous commenter points out that there is also Desktop::Notify, which communicates through D-Bus, rather than libnotify. Running
perl -MDesktop::Notify -e 'Desktop::Notify->new( app_name => "Venture")->create(summary => "Venture Bros", body => "Go Team Venture!")->show'
gives us
in Xfce and
in LXDE. These match our desktop perfectly, but they show up in the center of the screen and must be dismissed by hand. That's not always what we want. The libnotify (and growl, I think) notifications show up in the corner, have no buttons or window dressing, and dismiss themselves.
ETA (21 Dec 2011): I bet the anonymous commenter mentioned above is a KDE user. I just tried both the Gtk2::Notify and the Desktop::Notify one-liners above and they give the same result in KDE
I'm not sure if KDE is handing off to libnotify, handing off to dbus, or doing its own notification. In any case, Desktop::Notify does seem to be a nice option for KDE users. On the other hand, Gtk2::Notify looks exactly the same, so I'm not sure what's "jarring" about it.
Perl Hacks also has a nifty trick for doing something similar on a Mac using Mac::Growl.
http://my.safaribooksonline.com/book/programming/perl/0596526741/user-interaction/perlhks-chp-2-sect-4
Posted by: Kurt Edmiston | 12/15/2011 at 09:22 PM
Yeah, I guess we need an Any::Notify module to choose between libnotify, growl, and...whatever Windows uses.
Posted by: oylenshpeegul | 12/16/2011 at 04:31 AM
Desktop::Notify is better because by calling DBus it will show the appropriate widget native to your desktop environment instead of jarring Gtk2. It also installs faster from CPAN.
Posted by: Anonymous | 12/16/2011 at 06:07 AM
But Desktop::Notify doesn't give you the nice pop up in the corner for a few seconds and then go away on your own behavior of libnotify. At least, not by default. An obtrusive widget that pops up in the middle of the screen on top of everything else and must be clicked on to be dismissed is still obtrusive, no matter how well it matches my desktop environment.
Posted by: oylenshpeegul | 12/16/2011 at 02:00 PM