In this post we discussed how to set up system-wide defaults using GSettings schema overrides. This works great but we recently ran into a situation where this was not possible because the schema we wanted to modify was “relocatable”. Trying to modify such a schema without specifying a DConf path results in the following error:
$ gsettings set org.compiz.opengl sync-to-vblank true Schema 'org.compiz.opengl' is relocatable (path must be specified)
The correct way to change a relocatable schema is by appending the path, as the error message above states. For example:
$ gsettings get org.compiz.opengl:/apps/compiz-1/plugins/opengl/screen0/options/sync_to_vblank/ sync-to-vblank true
(Note the “:/apps/compiz-1/plugins/opengl/screen0/options/sync_to_vblank/ after the schema name; this is the path to the preference.)
The problem with this approach is that either by design or because it is a bug, it is not possible to write a schema override file that includes a DConf path. This Ubuntu bug seems to imply that this is a bug.
Another way to accomplish a system-wide default is by going to a lower level than GSettings and configuring DConf directly. It is probably better to use GSettings but in this particular case we had no option.
Here’s what we did:
First, we created the file /etc/dconf/profile/user with the following contents:
user-db:user system-db:system-wide
Next, we created the directory /etc/dconf/db/system-wide.d and the file /etc/dconf/db/system-wide.d/00_compiz_site_settings with the following contents:
[org/compiz/profiles/unity/plugins/opengl] enable-x11-sync=false
We then ran the command “dconf update” (as root) which created the DConf database /etc/dconf/db/system-wide (a binary file).
This causes the “opengl” Compiz plugin preference “enable-x11-sync” to be set to “false” for all users in the system.
References
This blog post from Ross Burton has a good discussion on how to set system-wide settings using GSettings: http://www.burtonini.com/blog/computers/gsettings-override-2011-07-04-15-45. It would have been a good reference to provide in my previous post but we missed it when we wrote that post.
The dconf System Administrator Guide is a fantastic reference to understand how to set system-wide defaults using DConf. One thing that was not clear to use after reading this document was that of DConf profile selection — the explanation above uses the file /etc/dconf/profiles/user because if no other DConf profile is selected (via the DCONF_PROFILE environment variable) then the profile called “user” is the one that is opened.
This post by Matt Fischer was extremely useful to understand how things work with DConf. Based on this post is that we realized we needed to use a profile called “user”.
Finally, this askubuntu.com question has very good insight into the differences between DConf and GSettings.
Pingback: Ubuntu:List and enable/disable Compiz plugins on command line – Ubuntu Linux Questions