从 bash 脚本激活 KDE 4 通知
我有一个由 crontab 激活并在后台运行的 bash 脚本。我想添加在执行期间发送通知的功能。我的 KDE 4 桌面有一个精美的通知系统,可以从托盘栏中弹出非模式消息,这非常适合我的需求。所以我正在寻找一种从 bash 脚本生成这些通知的方法,但我对 KDE 平台几乎一无所知,所以我陷入了困境。有人能指出我的解决方案吗?
I have a bash script activated by crontab and running in background. I would like to add to it the ability to send notifications during the execution. My KDE 4 desktop has a fancy notification system which pops out non-modal messages from the tray bar, and this would be perfect for my needs. So I was searching for a way to generate these notifications from a bash scripts, but I have almost no knowledge of the KDE platform and so I'm stuck. Can anybody point me to a solution?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
可以使用
kdialog
的被动弹出选项。例子:
kdialog
's passive popup option can be used.Example:
您还可以使用
notify-send
(在基于 Debian 的系统上,安装libnotify-bin
软件包):据我所知,这应该适用于多个窗口管理器(例如如 KDE 和 Gnome)。
编辑:消息的 HTML 格式仅适用于某些通知守护程序,因此应避免。
You may also use
notify-send
(on Debian-based systems, install thelibnotify-bin
package):To my best knowledge, this should work on several window managers (such as KDE and Gnome).
Edit: HTML formatting of the message will only work with certain notification daemons and should thus be avoided.
是 KDE 的一个选项,其中不需要超时。您甚至可以通过添加标题 (
--title
) 等来调整它 -->看kdialog --help
一方面值得一提的是,kdialog 安装在我的 openSuSE KDE4 系统上,而在这里没有安装 notification-send。
另一方面,notify-send 的优点是您可以在不同的桌面环境中使用它
is an option for KDE where the timeout is not necessary. you can tune this even with adding a headline (
--title
) and so on --> seekdialog --help
on the one hand it is worth mentioning, that kdialog was installed on my openSuSE KDE4 system whereas notify-send is not installed here.
on the other hand the advantage of notify-send is that you can use it with different desktop environments
确认通知发送适用于 XFCE4(基于 Debian 的 Mint),但
对我不起作用。由于某种原因,它使消息正文文本变成深灰色(几乎难以辨认),因此我将该 html 保留下来,标题(“摘要”)和正文文本都显示为白色。
很酷的是,您可以输入您喜欢的图标的绝对路径 -
例如
-i '~/myapps/foobarapp/icons/64x64/64x64.png'
Confirm that notify-send works with XFCE4 (Debian-based Mint), except the
<b><font color=red>
didn't work for me. For some reason it made the Message body text dark grey (virtually illegible), so I left that html out and the header ('Summary') and body text both come up white.What is cool is that you can put an absolute path to the icon your prefer --
e.g.
-i '~/myapps/foobarapp/icons/64x64/64x64.png'