Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I'm trying to make an app to switch your XFCE4-Panel's layout between 3 layouts. I applied those layouts and copied the XML file where Xfconf stores its configuration for the panel.
The general idea was that I could just remove the old file and copy over the new one. Only, that didn't work out so well. Something appears to be preventing me from changing the XML files without the use of xfconf-query. I could just reset the panels every time, let the script set the values to how they should be, and restart the panel, but the configuration files are a bit big to do all that (I'm also experiencing a few problems with the content of the panel when using xfconf-query).

So basically I want to know if there's a way to just apply the configuration of the whole XML file. Whether it's by killing some processes and quickly copying the files over, or by using something that automatically parses the XML file and sets all the values with xfconf-query. I'm using Python (combined with Bash) if someone knows some kind of class that can do it.

share|improve this question
    
Can you add an example layout for testing? AFAIK you cannot make live changes as long as xconfd is running (or you are using xfconf-query), but I'm not sure if the system will stay ok when killing it to apply the configuration. –  htorque Jan 8 '12 at 9:14
    
@htorque This is an example XML file for the panel layout: pastebin.com/e2wuJveq –  RobinJ Jan 8 '12 at 15:50
add comment

1 Answer

up vote 2 down vote accepted
+50

I found the following to work, but it requires a panel restart which results in a short flicker:

killall xfconfd
cp my-cfg-0.xml ~/.config/xfce4/xfconf/xfce-perchannel-xml/xfce4-panel.xml
xfce4-panel -r

or as one-liner for Python:

bash -c 'killall xfconfd && cp my-cfg-0.xml ~/.config/xfce4/xfconf/xfce-perchannel-xml/xfce4-panel.xml && xfce4-panel -r'

Restarting the panel will also restart the xfconfd daemon.

It works, but a better approach would be to use xfconf-query as this doesn't cause any flicker. You'd just have to figure out proper path-value pairs by parsing the XML file and apply them in one batch. Can't help you with that, sorry.

share|improve this answer
    
I had to restart the panel anyway, some changes don't apply straight away. I can't test your solution right now, but I'll award the bounty already because otherwise I'm likely to forget. I'll mark your answer as accepted once I've tested it. –  RobinJ Jan 10 '12 at 19:00
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.