13

By default, dconf stores its configuration in a binary format, inconvenient for using with version control.

dconf notes that there is a configuration setting for dconf that enables a "bi-directional" plain text mode that effectively mirrors the binary database with a plain text file.

Unfortunately, it gives little guidance on how to use this very promising-sounding functionality.

What is the most straightforward way to enable this?

1 Answer 1

14

It's all there (except the part with saving the current settings to that text file):

On startup, dconf consults the DCONF_PROFILE environment variable. If set, dconf will attempt to open the named profile, aborting if that fails. If the environment variable is not set, it will attempt to open the profile named "user" and if that fails, it will fall back to an internal hard-wired configuration. dconf stores its profiles in text files. DCONF_PROFILE can specify a relative path to a file in /etc/dconf/profile/, or an absolute path (such as in a user's home directory).

and

A "service-db" line instructs dconf to place the binary database file for the user database in XDG_RUNTIME_DIR. Since this location is not persistent, the rest of the line instructs dconf how to store the database persistently. A typical line is service-db:keyfile/user, which tells dconf to synchronize the binary database with a plain text keyfile in $XDG_CONFIG_HOME/dconf/user.txt. The synchronization is bi-directional.

So, the text file in question is $XDG_CONFIG_HOME/dconf/user.txt which usually corresponds to ~/.config/dconf/user.txt.
First, save your current settings to that file (obviously, this is not needed for a new user):

dconf dump / > ~/.config/dconf/user.txt

then append the service-db line to the profile (as root):

mkdir -p /etc/dconf/profile
printf '%s\n' 'service-db:keyfile/user' >> /etc/dconf/profile/user

Now, restart your session and the two files will be in sync.

1
  • In Debian 9, the needed dconf binary can be installed with apt install dconf-cli.
    – mivk
    Oct 23, 2019 at 16:18

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.