You are not logged in.
Pages: 1
Hello
Is there a way to change (insert, remove, or move the position of an item) an array using xfconf-query or must the array be recreated each time?
for example
xfconf-query -c xfce4-panel -p /plugins/plugin-13/items -n -a -t string -s "+lock-screen" -t string -s "-switch-user" -t string -s "-separator" -t string -s "-suspend" -t string -s "-hibernate" -t string -s "-hybrid-sleep" -t string -s "-separator" -t string -s "-shutdown" -t string -s "-restart" -t string -s "-separator" -t string -s "+logout" -t string -s "-logout-dialog"
Is there an equivalent += or -= or something to change the position, for something like a panel array?
On this particular array 'items" if an item is not included what is the default? plus or minus?
Thanks
Offline
Unfortunately no.
The only way to do that would be to extract all of the current values, readjust as needed in a separate list, and re-save the array in the new order. And this is assuming you know the type of all entries in advance as xfconf-query doesn't output types (https://gitlab.xfce.org/xfce/xfconf/-/issues/23).
You could create an enhancement request at the bug tracker.
Please remember to mark your thread [SOLVED] to make it easier for others to find
--- How To Ask For Help | FAQ | Developer Wiki | Community | Contribute ---
Offline
The only way to do that would be to extract all of the current values, readjust as needed in a separate list, and re-save the array in the new order.
That is what I do currently for my chtheme script https://forum.xfce.org/viewtopic.php?id=16655
I get the value of a xfce4 panel array (from a saved theme in this case) and populate a bash array, then inject it back into xfce4 panel array in a squirrelly kind of way..
...
xfconf-query -c xfce4-panel -p /panels/panel-$mainpanel/plugin-ids | grep ^[0-9] > "$postmp"
posarr=()
while read pos; do
posarr+=("$pos")
done < "$postmp"
rm "$postmp"
...
if (( ${#posarr[@]} )); then
pluginids="xfconf-query -c xfce4-panel -p /panels/panel-$mainpanel/plugin-ids -n -a
$(for pluginid in "${posarr[@]}"
do
echo -n "-t int -s $pluginid "
done
echo)"
${pluginids}
fi
...
}
And this is assuming you know the type of all entries in advance as xfconf-query doesn't output types
Yeah I noticed that, I usually get those by searching the forum, usually you (-:
Thanks for the info!
Offline
I've tried a couple of times to write a wrapper around xfconf-query to manage xfconf arrays, similar to what you've done, but I always got hung up on the "not knowing the type" issue.
xfconf has recently added gsettings support (compile time option) - meaning you could use gsettings instead of xfconf as the back-end. I wonder if gsettings has better support for array management (or better support for knowing array element type). I haven't had a chance to look deeper into this.
Please remember to mark your thread [SOLVED] to make it easier for others to find
--- How To Ask For Help | FAQ | Developer Wiki | Community | Contribute ---
Offline
For me setting the array is working just fine.
I tried it also on the Action Buttons item array (plugin-14 is just an example, which is the Action Buttons plugin in my case!):
xfconf-query -c xfce4-panel -p /plugins/plugin-14/items -n -a -t string -s "+lock-screen" -t string -s "-switch-user" -t string -s "-separator" -t string -s "-suspend" -t string -s "-hibernate" -t string -s "-hybrid-sleep" -t string -s "-separator" -t string -s "+shutdown" -t string -s "-restart" -t string -s "-separator" -t string -s "-logout" -t string -s "-logout-dialog"
Offline
Pages: 1
[ Generated in 0.006 seconds, 7 queries executed - Memory usage: 536.27 KiB (Peak: 537.12 KiB) ]