DConf – System Wide Configuration for Linux Desktop Apps

Some Linux desktop applications use dconf configuration. For example, dconf is used by programmer’s text editor Gedit and desktop backup program Deja-dup.

This post shows you how to extract your current settings and make them system wide.
As the configuration is just text, you can use Puppet and similar tools to use this configuration in your whole network of computers.

Background

Prequisites: command line basics, sudo
This article is written from memory.

Programs That Don’t Need DConf

Many programs have simple configurations files: user specific dotfile in home directory and system wide in /etc/. In that case, just edit the system wide file in /etc/ Рthe dconf setup described here is not needed. For example, Firefox web browser has system wide /etc/firefox/syspref.js and per-user  $HOME/.mozilla/firefox/*.default/prefs.js. Bash shell has $HOME/.bashrc and /etc/bash.bashrc.

Programs That Need DConf

Some desktop programs use dconf. In that case, you need to take special steps to configure them system wide. For example, dconf is used by gedit, deja-dup, gnumeric, update-manager, canonical indicator and gtk file-chooser.
A single user could just use graphical user interface to make his settings. But if you want to configure machines automatically, you must be able to give your configuration as text files. This article explains how to do this for dconf.
Make DConf Settings Using Graphical User Interface
Many GUI programs use dconf for settings.
Install gedit, make the changes trough GUI.

$ sudo apt-get -y install gedit gedit-plugins

Open Gedit in the menu, then use Preferences in the menu to change some settings. For example, let’s enable text size plugin for gedit, so that user can control-mousewheel for larger text.
See your settings as plain text. ‘dconf dump /’ shows all dconf settings. Then you can use less or grep to narrow down to interesting parts.

$ sudo apt-get -y install dconf-cli
$ dconf dump /|grep -C 5 gedit
[org/gnome/gedit/plugins]
active-plugins=['filebrowser', 'docinfo', 'spell', 'externaltools', 'time', 'textsize', 'modelines']

Apply Settings as System Wide Defaults

Create the required directories

$ sudo mkdir -p /etc/dconf/db/site.d/
$ sudo mkdir -p /etc/dconf/profile/

Create the boilerplate

$ sudoedit /etc/dconf/profile/user
## /etc/dconf/profile/user
user-db:user
system-db:site
$ sudoedit /etc/dconf/db/site.d/00_site_settings
## /etc/dconf/db/site.d/00_site_settings
[org/gnome/gedit/plugins]
active-plugins=['filebrowser', 'docinfo', 'spell', 'externaltools', 'time', 'textsize', 'modelines']

Test

Finally, log in as a new user (without the per-user settings), open gedit and see that your defaults are really in use.

$ sudo adduser terote01

Log out, log in as terote01. Open Gedit. Use ctrl-mousewheel to change text size. If it changes, you have succesfully enabled textsize with system wide configuration.
Well done! What settings deserve to be system wide in your network?

/etc/dconf/db/site.d/

Updated: fixed how cli looks like

Posted in Uncategorized | Tagged , , , , , | Comments Off on DConf – System Wide Configuration for Linux Desktop Apps

Comments are closed.