I have an installed plugin, that I want to add to the panel. I can always do that via xfce4-panel GUI. But my question is how can I do that via terminal so no GUI is being called.
xfce4-panel --add=PLUGIN-NAME will call GUI asking for a panel number.
xfce4-panel --add-items=PANEL-NUMBER will call GUI asking for a plugin to be added.
How can I combine these commands so no GUI will be called, i.e. is there a way to add a plugin to the specific panel, assuming that I know panel’s number?
So far, the panel and plugins settings in XFCE is saving in own database, wich can be controlled either editing xml files at $HOME/.config/xfce4/xfconf/xfce-perchannel-xml folder, either using command-line util 'xfconf-query', either via GUI tool for that called xfce4-settings-editor.
The panels data in that database are stored in channel 'xfce4-panel' under property '/panels'. Each panel contains their plugins list in their order under "/panels/panel-0/plugin-ids" property, where "panel-0" is panel name.
These ids point to all available plugins that are listed in the same channel "xfce4-panel" under property "/plugins".
So for adding new plugin to panel programmatically you need:
Some code:
# 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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With