【问题标题】:How to add xfce4-panel plugin to the specific panel via terminal?如何通过终端将 xfce4-panel 插件添加到特定面板?
【发布时间】:2018-08-12 12:19:05
【问题描述】:

我有一个已安装的插件,我想将它添加到面板中。我总是可以通过 xfce4-panel GUI 做到这一点。但我的问题是如何通过终端执行此操作,这样就不会调用 GUI。

xfce4-panel --add=PLUGIN-NAME 将调用 GUI 询问面板编号。

xfce4-panel --add-items=PANEL-NUMBER 将调用 GUI 请求添加插件。

如果我知道面板的编号,我如何组合这些命令以便不会调用 GUI,即是否有办法将插件添加到特定面板?

【问题讨论】:

  • 不幸的是,我认为目前这不可能。阅读源代码,我发现这些命令只是将调用调度到 dbus 方法12,并且它们的实现不支持您所需要的。您可以尝试file a bug 请求此改进。
  • @AndreLDM 感谢您的关注。有可能,我想出了一个使用xfconf-query 的解决方案,但我一直没有时间上传答案。但是,一旦我有空闲时间,我就会这样做。
  • @MOPO3OB 我们还在等待...
  • 自己添加答案,迟到总比没有好。

标签: bash plugins terminal panel xfce


【解决方案1】:

到目前为止,XFCE 中的面板和插件设置保存在自己的数据库中,可以通过命令行工具“xfconf-query”或通过 GUI 工具来控制编辑 $HOME/.config/xfce4/xfconf/xfce-perchannel-xml 文件夹中的 xml 文件那个叫xfce4-settings-editor

该数据库中的面板数据存储在属性“/panels”下的通道“xfce4-panel”中。每个面板在“/panels/panel-0/plugin-ids”属性下按顺序包含其插件列表,其中“panel-0”是面板名称。

这些 id 指向属性“/plugins”下的同一通道“xfce4-panel”中列出的所有可用插件。

因此,要以编程方式将新插件添加到面板,您需要:

  1. 将插件名称添加到“/plugins”属性中
  2. 将该插件 ID 添加到所选面板的“/plugin-ids”属性中

一些代码:

# xfconf-query not yet support adding individual entries to array 
# so need override all plugins in the panel
# before using this command adapt it to your current list 
# of plugins + simply add your new
# copying and executing this command without adopting may broke your panel 
# do not execute as is
xfconf-query -n -c xfce4-panel -p "/panels/panel-0/plugin-ids" -a \
            -t int -s 1  -t int -s 2  -t int -s 3  -t int -s 4  -t int -s 5  \
            -t int -s 6  -t int -s 7  -t int -s 8  -t int -s 9  -t int -s 10 \
            -t int -s 11 -t int -s 12 -t int -s 13
# so last 13 is our new plugin id, lets add it

# adding new plugin with id 13, lets this be 'xkb' plugin (language layout switcher)
xfconf-query -c xfce4-panel -pn "/plugins/plugin-13" -t string -s 'xkb'

# restart panels for taking effect
xfce4-panel --restart

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2015-05-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-12-09
    • 1970-01-01
    • 1970-01-01
    • 2018-08-10
    相关资源
    最近更新 更多