如何在 Manjaro Linux 上阅读系统范围的通知?
How to read system-wide notifications on Manjaro Linux?
我正在尝试编写 Python 脚本以从系统通知中获取信息,然后执行操作。
如何阅读系统范围内的通知文本?
我正在使用 Notify 创建和发送通知,但我无法从另一个脚本中检索该数据。
这是我的'create'代码
import gi
gi.require_version('Notify', '0.7')
from gi.repository import Notify
Notify.init("App Name")
Notify.Notification.new("Hi").show()
通知通过 DBus 从程序传递到显示它们的另一个程序。您可以通过以下方式监控 DBus 对方法 org.freedesktop.Notifications.Notify
的所有调用来捕获通知:
dbus-monitor interface=org.freedesktop.Notifications,member=Notify
这也可以通过将 eavesdrop='true'
添加到匹配字符串的绑定来完成。
我正在尝试编写 Python 脚本以从系统通知中获取信息,然后执行操作。
如何阅读系统范围内的通知文本?
我正在使用 Notify 创建和发送通知,但我无法从另一个脚本中检索该数据。
这是我的'create'代码
import gi
gi.require_version('Notify', '0.7')
from gi.repository import Notify
Notify.init("App Name")
Notify.Notification.new("Hi").show()
通知通过 DBus 从程序传递到显示它们的另一个程序。您可以通过以下方式监控 DBus 对方法 org.freedesktop.Notifications.Notify
的所有调用来捕获通知:
dbus-monitor interface=org.freedesktop.Notifications,member=Notify
这也可以通过将 eavesdrop='true'
添加到匹配字符串的绑定来完成。