3

How can i export and import Compiz current profile settings using Command line. I'm using ubuntu 12.10. Or can i get a script for doing export and import.

3

I'm not sure of a command line utility, but you can easily do this with a script in Python and python-compizconfig package. Here you go:

#!/usr/bin/python
import sys, os
import compizconfig

#The last input on the command line will be the path to save the file to.
savefile=sys.argv[-1]

context=compizconfig.Context()
#Change keyword if you want to skip saving entries that are default
context.Export(os.path.abspath(savefile),skipDefaults=False)

To import settings, you could just change the last line to context.Import(os.path.abspath(savefile))

Now to run, just save and chmod +x scriptname.py and run ./scriptname.py FILE or run with python scriptname.py FILE if you don't chmod.

WARNING- I have only tested a bit and basic functionality works, but I guarantee nothing. The script can be made much more robust and functional.

| improve this answer | |
  • Thank you very much +Ian B. This is what I exactly needed...Thanks – Vishal Vijay Jan 18 '13 at 3:19
  • When running from the crontab it only exports default values for everyting... any idea how to solve? – lpanebr Aug 8 '15 at 9:45
2

Small update I wanted to add to importing that I found.

#!/usr/bin/python
#http://askubuntu.com/questions/244333/compiz-profile-settings-export-and-import-using-command-line
import sys
import compizconfig

#The last input on the command line will be the path to save the file to.
savefile=sys.argv[-1]

context=compizconfig.Context()

#saveFile is the name of the file. True specifies whether or not to overwrite current settings.
context.Import(savefile, True)

I was having an issue on import where it didn't seem to be overwriting the default values. Appending True to the end of the Import statement seems to have fixed that.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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