You are not logged in.
Pages: 1
Since ToZ kindly introduced me to the brilliant XFCE tool Xfconf-query I've been delighted to make use of it so far for toggling on/off both my desktop icons and panel.
Next I wanted to also use it to switch between a single and double row panel layout. Making use of the -m monitoring functionality to find out how to control different settings (e.g. xfconf-query -c xfce4-panel -m to monitor changes to the panel) I was able to switch the panel to "X" number of rows with:
xfconf-query -c xfce4-panel -p /panels/panel-1/nrows -s X
and then I was also able to switch to clock layout "X" with the following, so as to hide the date in single row mode where there is no space for it:
xfconf-query -c xfce4-panel -p /plugins/plugin-12/digital-layout -s X
The final remaining challenge is to swap the order of the first two panel items so as the Whisker menu always stays on the bottom far left. This is seems to be a lot more complicated as it involves the array displayed with:
xfconf-query -c xfce4-panel -p /panels/panel-2/plugin-ids
For example, if I setup a quick second panel with five items on it for testing purposes (highly recommended NOT to experiment with this on your main panel, or in any case make a panel profile backup first so you can quickly revert changes when things break...), then running the above command returns:
Value is an array with 5 items:
15
19
17
25
23
If I manually swap the order of the first two items in panel preferences, the first two numbers become swapped here as expected:
Value is an array with 5 items:
19
15
17
25
23
I found it very difficult to figure out how to modify this array from the examples in the documentation, but eventually was able to come up with the following:
[THIS WILL BREAK YOUR PANEL!]
xfconf-query -c xfce4-panel -p /panels/panel-2/plugin-ids -t string -s 19 -t string -s 15 -t string -s 17 -t string -s 25 -t string -s 23
This command runs without error, and appears to successfully change the returned array from the first case to the second. However, when I restart the panel to see the changes, the end result is that all items have been deleted from it. Even if I run this command without changing the order of the elements, it still results in everything on the panel getting lost.
Any suggestions on how to resolve this would be much appreciated!
Offline
The value types in that array should be "int" not "string". By changing the type you probably corrupted the array so it couldn't be read by the panel (it would be looking for ints). However, you don't need to specify them if you are just re-arranging order:
xfconf-query -c xfce4-panel -p /panels/panel-2/plugin-ids -s 19 -s 15 -s 17 -s 25 -s 23
xfconf-query -c xfce4-panel -p /panels/panel-2/plugin-ids -s 23 -s 25 -s 17 -s 15 -s 19
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
Thank you for the correction!
I've been doing my best to learn about bash arrays, but after a few days of trying many different arrangements of the xfconf-query output.. enclosed by different brackets, quotation marks, comma separated, with/without the preceding text etc... I still haven't been able to find what the correct syntax should be to have it successfully recognised within a value function. I.e. what the correct replacement should be for "XXXX" in the below:
#Swap Whisker menu and Places plugin order on panel
value=$( xfconf-query -c xfce4-panel -p /panels/panel-2/plugin-ids )
if [ $value -eq XXXX ]
then
xfconf-query -c xfce4-panel -p /panels/panel-2/plugin-ids -s 15 -s 19 -s 17 -s 25 -s 23
else
xfconf-query -c xfce4-panel -p /panels/panel-2/plugin-ids -s 19 -s 15 -s 17 -s 25 -s 23
fi
In any case, the downside of this approach is that it requires the panel to be restarted to take effect, which isn't so nice compared to the instant switch in layout achieved without re-ordering. So in the end I might try to rearrange my panel to avoid having to do this.
Offline
Pages: 1
[ Generated in 0.012 seconds, 7 queries executed - Memory usage: 532.43 KiB (Peak: 533.27 KiB) ]