Configuration of Gnome Extensions

Upon successful configuration of ‘dconf’ within my ‘home-manager’ and the following activation of GNOME extensions using declarative methods, I am curious whether there exists a possibility to retain the settings of these extensions within my system configuration.

Was anyone successful in doing this?

The dconf NixOS module recently gained support for this but it is still experimental.

2 Likes

I manage my GNOME configuration via the NixOS dconf module here. You can ensure extensions are enabled by default using it as well. I have successfully used it for a few weeks now across two tmpfs root devices.

1 Like

Thank you @jtojnar, @Electrostasy for your comprehensive responses. Your guidance allowed me to successfully set up dconf to modify the configurations of two extensions that I frequently use.

blur-my-shell
"org/gnome/shell/extensions/blur-my-shell" = {
        "blacklist"="@as []";
	"blur-on-overview"=false;
	"brightness"="1.0";
	"customize"=true;
	"enable-all"=true;
	"opacity"="250";
	"sigma"="59";
	"blur"=true;
      };
pop-shell
      "org/gnome/shell/extensions/pop-shell" = {
      	"active-hint"=false;
	"active-hint-border-radius"="uint32 6";
	"tile-by-default"=true;
	"gap-inner"="uint32 2";
	"gap-outer"="uint32 2";
	"mouse-cursor-follows-active-window"=true;
	"show-skip-taskbar"=true;
	"show-title"=true;
	"stacking-with-mouse"=true;
      };

For the benefit of any individual curious about the methodology employed, I executed the command dconf dump /org/gnome/shell/extensions/(extension_name)/ in the terminal, which gave me the list of settings (gnome.dconf-editor also works as a GUI). The following stage consisted of incorporating these settings into the home-manager, which proved to be straightforward.

However, it is important to note that this procedure was not entirely devoid of challenges. Initially, the execution of dconf dump command only provided a part of the settings. To ensure the display of all the settings, it was necessary for me to manually navigate to ExtensionsSettings (on the required extension) and press the buttons to prompt an update within dconf.

Should anyone possess insight as to why this situation arose, I invite them to share their knowledge. I shall keep this discussion active for such purpose.

GSettings system includes default values in the schema (example). Thanks to that, the dconf database will only contain values for settings keys that have been changed from the defaults. For that reason, the extensions should have no entries there, initially.

Few more tips:

  • dconf dump / can be a bit noisy. If you want a more focused view, you can run dconf watch / command. That will print which keys were modified whenever you change some setting in the GUI.
  • For convenience, you can also use dconf2nix tool to convert the output of dconf dump. Although it currently does not fully support the Nixpkgs GVariant library, which is slightly different from the one in home-manager.
1 Like