Nat*_*man 5 notification messaging-menu
我想编写一个应用程序,当消息菜单被激活(蓝色信封亮起)和每当它被停用(蓝色信封恢复为其默认颜色)时都会收到通知。
有什么办法可以收到通知吗?在这种情况下,我并不真正关心编程语言 - 尽管 C、Python 或 PHP 会是首选。
有趣的问题。没有用于发现消息菜单是否已更改其状态的官方 API。您可以通过查看指标消息服务的 DBus 接口来实现。一个shell脚本方式是这样的:
$ gdbus call --session --dest com.canonical.indicator.messages --object-path /com/canonical/indicator/messages/service --method com.canonical.indicator.messages.service.AttentionRequested
Run Code Online (Sandbox Code Playgroud)
还有一个信号“ AttentionChanged”。您可以跟踪它以确定更新时的状态。
此外,如果您对消息菜单中的各个项目感兴趣,那么它们的所有信息都将使用libindicate导出。可以在 DBus 上使用另一个 libindicate 侦听器来获取所有信息并以不同的方式对其进行聚合。