dbus-send如何从Zathura获取页面数?
我正在尝试使用dbus-send
从Zathura获取页面总数(Zathura是PDF查看器)(请参阅下面的图)。我不熟悉DBU(无论我如何尝试学习,我总是放弃)。
我可以使用GUI程序查看页面的总数numberOfpages
当我双击该属性时,我会得到该值。
但是,我正在尝试使用dbus-send
获得相同的信息。我在终端上尝试了以下内容:
dbus-send --session --dest=org.pwmt.zathura.PID-1057698 \
--print-reply org.pwmt.zathura.Properties.numberofpages
上面的命令不起作用。
您能告诉我如何构建一个dbus-command以获取numberOfpages
值?
I am trying to use dbus-send
to get the total number of page from zathura (Zathura is a PDF viewer) (See figure below). I am not familiar with DBus (no matter how I try to learn it, I always give up).
I could use a GUI program to see the total number of pages numberofpages
when I double click on that property I get the value.
However, I am trying to get the same information using dbus-send
. I tried the following on the terminal:
dbus-send --session --dest=org.pwmt.zathura.PID-1057698 \
--print-reply org.pwmt.zathura.Properties.numberofpages
The command above doesn't work.
Could you please tell me how can I construct a dbus-command to get the numberofpages
value?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
使用
Busctl
而不是dbus-send
,这可能更容易。无论哪种方式,对于大多数D-Bus情况,您都需要了解四个信息。org.pwmt.zathura.pid-1057698
/org/pwmt/pwmt/zathura
org.pwmt.zathura
numberOfpages
我希望您的情况会看起来像:
在大多数机器上可能运行的服务上尝试此情况:
org.freedesktop.systemd1
/org/freedesktop/systemd1
org.freedesktop.systemd1.manager
架构
与两个实用程序运行:
dbus-send
butctl
This might be easier to do using
busctl
rather thandbus-send
. Either way there is four bits of information you need to know for most D-Bus situation.org.pwmt.zathura.PID-1057698
/org/pwmt/zathura
org.pwmt.zathura
numberofpages
I would expect your situation to look like:
To try this on a service that is likely to be running on most machines:
org.freedesktop.systemd1
/org/freedesktop/systemd1
org.freedesktop.systemd1.Manager
Architecture
And to run it with both utilities:
dbus-send
busctl
用
dbus-send
命令搏斗后,我找到了正确的语法:该命令的输出是:
我可以使用GREP获取值
46
(在我的案例PDF文档中的页面总数)。After wrestling with
dbus-send
command, finally I found the right syntax:The output of that command is:
I can use grep to get the value
46
(which is in my case the total number of pages in the PDF document).