Is there something better than libnotify?

1.7k Views Asked by At

I'm trying to write some code against libnotify, but the documentation for perl with libnotify is seriously lacking. So is there something that, as of 2011-08-26, is "better" than libnotify? All I need is to send a notification to the currently logged in user on a Linux machine (Ubuntu specifically).

3

There are 3 best solutions below

0
On BEST ANSWER

Gtk2::Notify does seem to lack good documentation, but you can browse through some examples at http://cpansearch.perl.org/src/FLORA/Gtk2-Notify-0.05/examples/ including the basic one:

#!/usr/bin/perl

use strict;
use warnings;
use Gtk2::Notify -init, 'Basic';

my $n = Gtk2::Notify->new('Summary', 'This is some sample content');
$n->show; 

In fact this seems pretty cool, I may use it for something soon! Thanks for bringing it to my attention.

Otherwise:

On Linux you can use zenity to send a popup message, and to send it to another user's screen you have to play with some environment variables but it can be done. From Perl I would set the appropriate %ENV values and then just execute system or backtick (``) calls to zenity.

Perhaps start here http://www.cyberciti.biz/tips/spice-up-your-unix-linux-shell-scripts.html

Also from within that link, perhaps libnotify-bin/notify-send would also work, depending on the message you are sending.

perl -E '$ENV{DISPLAY} = ":0.0";`notify-send "Hello World"`;'
0
On

As far as I can tell freedesktop specification contains a notification service which can be accessed via dbus. Here is a link to a perl module for that feature.

0
On

From what I searched, when porting an application from Windows to Linux, there's no :(

I'll glad to here if there's.

Update: Indeed I was talking about libinotify and not about libnotify.