还有比 libnotify 更好的东西吗?

发布于 2024-12-01 18:41:33 字数 158 浏览 0 评论 0原文

我正在尝试针对 libnotify 编写一些代码,但是使用 libnotify 的 perl 文档严重缺乏。那么,截至 2011 年 8 月 26 日,有什么东西比 libnotify “更好”吗?我所需要的只是向 Linux 计算机(特别是 Ubuntu)上当前登录的用户发送通知。

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).

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

拥抱我好吗 2024-12-08 18:41:33

Gtk2::Notify 似乎缺乏良好的文档,但您可以浏览 http://cpansearch.perl.org/src/FLORA/Gtk2-Notify-0.05/examples/ 包括基本的:

#!/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; 

事实上,这看起来很酷,我可以用它来做点什么很快!感谢您引起我的注意。

否则:

在 Linux 上,您可以使用 zenity 发送弹出消息,并将其发送到另一个用户的屏幕,您必须使用一些环境变量,但这是可以完成的。在 Perl 中,我会设置适当的 %ENV 值,然后执行 system 或对 zenity 的反引号 (``) 调用。

也许从这里开始 http://www.cyberciti。 biz/tips/spice-up-your-unix-linux-shell-scripts.html

同样来自该链接,也许是 libnotify-bin/notify-send 也可以工作,取决于您发送的消息。

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

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"`;'
梦里的微风 2024-12-08 18:41:33

根据我的搜索,当将应用程序从 Windows 移植到 Linux 时,没有:(

如果有的话,我很高兴来到这里。

更新:确实,我正在谈论 libinotify 而不是 libnotify。

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.

娇妻 2024-12-08 18:41:33

据我所知,freedesktop 规范包含一个可以通过 dbus 访问的通知服务。
以下是 perl 模块的链接 对于该功能。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文