Bash 如何在dbus监视器中检测通知的发送方和目的地?
我的目标是过滤来自不同应用程序(主要是来自不同浏览器窗口)的通知 我发现在dbus监视器的帮助下,我可以编写一个小脚本来过滤我感兴趣的通知消息。 过滤器脚本运行良好,但我有一个小问题: 我先从Bash 如何在dbus监视器中检测通知的发送方和目的地?,bash,dbus,ubuntu-20.04,sender-id,Bash,Dbus,Ubuntu 20.04,Sender Id,我的目标是过滤来自不同应用程序(主要是来自不同浏览器窗口)的通知 我发现在dbus监视器的帮助下,我可以编写一个小脚本来过滤我感兴趣的通知消息。 过滤器脚本运行良好,但我有一个小问题: 我先从 dbus-monitor "interface='org.freedesktop.Notifications', destination=':1.40'" 指挥部。我必须添加“destination=”:1.40',因为在Ubuntu 20.04上,我总是收到两次相同的通知。 以下是
dbus-monitor "interface='org.freedesktop.Notifications', destination=':1.40'"
指挥部。我必须添加“destination=”:1.40',因为在Ubuntu 20.04上,我总是收到两次相同的通知。
以下是
dbus-monitor --profile "interface='org.freedesktop.Notifications'"
说明原因:
type timestamp serial sender destination path interface member
# in_reply_to
mc 1612194356.476927 7 :1.227 :1.56 /org/freedesktop/Notifications org.freedesktop.Notifications Notify
mc 1612194356.483161 188 :1.56 :1.40 /org/freedesktop/Notifications org.freedesktop.Notifications Notify
如您所见,发件人:1.277首先发送到:1.56,然后这将是发件人发送到:1.40目的地。(只需notify send hello
test消息已发送)
我的脚本正在以这种方式工作,但每次系统启动时,我都必须检查目标编号,并相应地修改脚本才能工作
我有两个问题: