Xfce Forum

Sub domains
 

You are not logged in.

#1 2023-04-29 18:32:15

bthompson
Member
Registered: 2023-04-27
Posts: 4

xfconf-query arrays

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

#2 2023-04-30 10:16:08

ToZ
Administrator
From: Canada
Registered: 2011-06-02
Posts: 11,484

Re: xfconf-query arrays

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

#3 2023-04-30 15:29:58

bthompson
Member
Registered: 2023-04-27
Posts: 4

Re: xfconf-query arrays

ToZ wrote:

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
...
}
ToZ wrote:

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

#4 2023-04-30 20:35:28

ToZ
Administrator
From: Canada
Registered: 2011-06-02
Posts: 11,484

Re: xfconf-query arrays

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

#5 2024-02-10 21:46:12

danger89
Member
From: The Netherlands
Registered: 2019-03-23
Posts: 2
Website

Re: xfconf-query arrays

For me setting the array is working just fine. smile

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

Registered users online in this topic: 0, guests: 1
[Bot] ClaudeBot

Board footer

Powered by FluxBB
Modified by Visman

[ Generated in 0.005 seconds, 7 queries executed - Memory usage: 536.49 KiB (Peak: 537.34 KiB) ]