ubuntu 播放音乐等的提示信息的方块是怎么实现的?

软件和网站开发以及相关技术探讨
回复
loujiaye
帖子: 29
注册时间: 2013-10-16 12:43
系统: ubuntu 12.04

ubuntu 播放音乐等的提示信息的方块是怎么实现的?

#1

帖子 loujiaye » 2015-04-17 10:31

见图

这个有办法通过程序控制吗
附件
图中这个提示信息的方块
图中这个提示信息的方块
头像
astolia
论坛版主
帖子: 6396
注册时间: 2008-09-18 13:11

Re: ubuntu 播放音乐等的提示信息的方块是怎么实现的?

#2

帖子 astolia » 2015-04-17 14:17

这是linux的桌面通知框架,算是一个标准了。ubuntu现在用的是notify-osd实现,以前用的是notification-daemon。
程序中一般通过libnotify库进行处理,直接通过dbus发消息也行
有命令行工具notify-send,包含在libnotify-bin包中。一般的脚本编程可以考虑用这个

代码: 全选

notify-send -i face-cool 标题 这是内容

代码: 全选

$ notify-send --help
Usage:
  notify-send [OPTION...] <SUMMARY> [BODY] - create a notification

Help Options:
  -?, --help                        Show help options

Application Options:
  -u, --urgency=LEVEL               Specifies the urgency level (low, normal, critical).
  -t, --expire-time=TIME            Specifies the timeout in milliseconds at which to expire the notification.
  -a, --app-name=APP_NAME           Specifies the app name for the icon
  -i, --icon=ICON[,ICON...]         Specifies an icon filename or stock icon to display.
  -c, --category=TYPE[,TYPE...]     Specifies the notification category.
  -h, --hint=TYPE:NAME:VALUE        Specifies basic extra data to pass. Valid types are int, double, string and byte.
  -v, --version                     Version of the package.

loujiaye
帖子: 29
注册时间: 2013-10-16 12:43
系统: ubuntu 12.04

Re: ubuntu 播放音乐等的提示信息的方块是怎么实现的?

#3

帖子 loujiaye » 2015-04-18 14:54

多谢 :em05
回复