Knowledge Base

Preserving for the future: Shell scripts, AoC, and more

dconf save and load from file

dconf save and load to file

GNOME-based desktops use a settings utility that is a little similar to the registry of a famous non-free operating system. I'll spare you the ideological diatribe and get to the task at hand. I use Cinnamon from the Linux Mint project, and it is based on GNOME 3. The command line tool for manipulating the settings is titled dconf.

Saving dconf settings to file

Dumping its output is easy.

dconf dump /


[net/launchpad/plank/docks/dock1]
icon-size=32
show-dock-item=false
position='left'
dock-items=['org.gnome.Terminal.dockitem', 'nemo.dockitem', 'firefox.dockitem']
unhide-delay=0
items-alignment='center'

Redirect to a file and you're done.

dconf dump / > my-cinnamon.dconf

Pick a subdirectory if you wish to narrow it down.

dconf dump /org/cinnamon/sounds/


[/]
maximize-enabled=false
unmaximize-enabled=false
tile-enabled=false
map-enabled=false
close-enabled=false
minimize-enabled=false
switch-enabled=false

Loading dconf settings from file

The reverse is also as easy. Make sure you use the same directory in the layout.

dconf load / < my-cinnamon.dconf

The story

This post is a precursor to a discussion about manipulating the settings programmatically in xfconf-query, which is the settings cli tool for the xfce desktop environment. I wrote a wrapper script for a project of mine. Check out dconf.sh at gitlab underneath my project bgconf.

Comments