到目前为止,XFCE中的panel和plugins设置保存在自己的数据库中,可以控制在
$HOME/.config/xfce4/xfconf/xfce-perchannel-xml
文件夹,可以使用命令行util'xfconf query',也可以通过GUI工具
xfce4-settings-editor
.
该数据库中的面板数据存储在属性“/panels”下的通道“xfce4 panel”中。每个面板都按顺序在“/panels/panel-0/plugin ids”属性下包含插件列表,其中“panel-0”是面板名称。
因此,要以编程方式向面板添加新插件,您需要:
-
按名称将插件添加到“/plugins”属性
-
一些代码:
# 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