开发者

Is there something better than libnotify?

I'm trying to write some code against libnotify, but the documentation for perl with libnotify is seriously lacking. S开发者_C百科o 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).


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"`;'


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.


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

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜