How can I view the content of a backup of the dconf database file?
To view the content of that file you could rename it - e.g. test
- place it under ~/.config/dconf/
and then have dconf
read/dump the settings from that file.
By default, dconf
reads the user-db found in $XDG_CONFIG_HOME/dconf/
:
A
"user-db"
line specifies a user database.
These databases are found in$XDG_CONFIG_HOME/dconf/
. The name of the file to open in that directory is exactly as it is written in the profile. This file is expected to be in the binary dconf database format. Note thatXDG_CONFIG_HOME
cannot be set/modified per terminal or session, because then the writer and reader would be working on different DBs (the writer is started by DBus and cannot see that variable).
As a result, you would need a custom profile that points to that particular db file - e.g. user-db:test
and then instruct dconf
to dump the data (using the custom profile) via the DCONF_PROFILE
environment variable:
cd
cp /path_to_backup_dconf/user ~/.config/dconf/test
printf %s\\n "user-db:test" > db_profile
DCONF_PROFILE=~/db_profile dconf dump / > old_settings
The result is a file (old_settings
) containing the settings from your backed up dconf
file, e.g.:
[org/gnome/desktop/interface]
font-name='DejaVu Sans Oblique 10'
document-font-name='DejaVu Sans Oblique 10'
gtk-im-module='gtk-im-context-simple'
clock-show-seconds=true
icon-theme='HighContrast'
monospace-font-name='DejaVu Sans Mono Oblique 10'
[org/gnome/desktop/input-sources]
sources=@a(ss) []
xkb-options=@as []
[org/gnome/desktop/wm/preferences]
num-workspaces=4
titlebar-font='DejaVu Sans Bold Oblique 10'
.......
You could then remove those files:
rm -f ~/db_profile ~/.config/dconf/test
and load the old settings into the current database:
dconf load / < old_settings
If you want to dump only specific settings just provide the path:
DCONF_PROFILE=~/db_profile dconf dump /org/gnome/desktop/wm/preferences/
[/]
num-workspaces=4
titlebar-font='DejaVu Sans Bold Oblique 10'
but note that for each path you should have a different file and when you load it you should specify the path accordingly:
dconf load /org/gnome/desktop/wm/preferences/ < old_wm_settings
Also note that, due to upstream changes, older dconf
databases might contain paths, keys and values that are invalid in newer versions so full compatibility between db-files created by different versions of dconf
isn't always guaranteed. In that case, you would have to inspect the resulting old_settings
file and manually remove or edit the entries that are invalid before loading it into your current database.