15

Am creating a dotfiles git repo for my gnome setup and would like the precise settings for the Gnome extensions to be transferrable across installations

I found that the extensions themselves are stored in ~/.local/share/gnome-shell/extensions directory but I couldn't find the preferences I set in an extension (say Screenshot Tool for example) inside that directory, it's just Javascript and Style files

What's even more confusing is that in order to watch for changes...

I initialized a git repo on the entire home directory and committed everything for a clean workspace, went and changed a keybinding for the extension but git didn't detect any change via git diff

What is going on here? Where can I find a preferences file like an XML or JSON or even .conf for an extension?

2 Answers2

24

Schema Files

The default extension settings are located in an *.xml file in the following directory if you installed the extension globally:

/usr/share/gnome-shell/extensions/<extension directory>/schemas

The default extension settings are located in an *.xml file in the following directory if you installed the extension locally (which seems to be your case):

~/.local/share/gnome-shell/extensions/<extension directory>/schemas

In the *.xml file, the <key> tags will list the keys. The <default> tags will contain the default values. You could manually edit these files. In order to transfer settings across systems, you will need to update the extension's *.xml "gschema" file.

In the example extension you referenced above, the settings are located at Screenshot configurations.

If you edit these files on your installed system, you will need to recompile the "gschema" by running one of the following commands.

If you had installed the extension globally, execute:

sudo glib-compile-schemas /usr/share/gnome-shell/extensions/<extension directory>/schemas

If you had installed the extension locally, execute:

glib-compile-schemas ~/.local/share/gnome-shell/extensions/<extension directory>/schemas

This will create an updated gschemas.compiled file in the extension's schema directory.

Gsettings

When you change a setting using a GUI (the extension's settings dialog), the change is actually stored in gsettings.

You can use Dconf Editor to locate the key and value for a particular "gsetting".

Install Dconf Editor using:

sudo apt install dconf-editor

(You can also use the gsettings commandline tool instead of the Dconf Editor GUI tool).

The <schema> or <path> tags in *.xml file (as described above) will tell you which schema to navigate to in Dconf Editor. (Hint, it will be under /org/gnome/shell/extensions/). The *.xml file will also list which keys can be configured.

You can search for the schema and key in Dconf Editor, and make changes.

In my experience, most extension settings are stored in "relocatable" schemas. Effectively, this means you can search for them and change them using Dconf Editor only after they have been set at least once. Otherwise the key simply will not be available in Dconf Editor, and you will consequently not be able to change its value. This is because the default values from the *.xml files (as described above) are used when there are no gsettings to override them.

Because you want to transfer these settings across installations, try exporting your gsettings, and loading them onto your new machine. See this answer to another question for instructions. (This approach may be actually easier then editing the *.xml files, described above).

Watch for Changes

A good way to watch for gsettings changes, as you make them, is to run the following command:

dconf watch /

This will show you which schema and key you just changed.

Install the the dconf commandline tool using:

sudo apt install dconf-cli
Enterprise
  • 12,352
0

In some cases, including when you set the environment variable GSETTINGS_BACKEND to keyfile, a text file will be created at $XDG_CONFIG_HOME/glib-2.0/keyfile, storing all the extension settings.

This would be useful in developing and testing extensions. For example, in the case of using this script, you can copy the file around to make a reproducable environment for testing.