GSettings and GtkSettings, I'm quite confused

Hello,
I’m about to write a GTK settings configuration editor and I see that in GtkSettings documentation:

On Wayland, the settings are obtained either via a settings portal, or by reading desktop settings from DConf.

Ok, so on Wayland only I can use GSettings, but the settings use different names…

[…] In the absence of these sharing mechanisms, GTK reads default values for settings from settings.ini

I was able to read using g_object_get(), but not write, and somewhere I read that GtkSettings is not made as configuration facility… why if the settings.ini uses the same key names?

GtkSettings is a configuration of last resort: it’s used if, and only if, no other configuration sources are available. It’s not meant to be a configuration mechanism for users to override the environment’s configuration: it’s meant to provide configuration in the absence of a platform.

On X11, there is a “vendor neutral” way to notify toolkits of configuration changes called XSETTINGS; it’s not a configuration storage. GTK uses XSETTINGS to get notified by other components that specific settings have changed.

On Wayland-based environments there is no XSETTINGS, so GTK uses the corresponding GSettings keys; dconf is a GSettings backend, and the documentation should never refer to dconf as a source: please, file an issue about the wording.

The additional function of GtkSettings is to provide the ability for application developers to modify the configuration for their application only; for instance, an application can add a UI control to toggle the GtkSettings:gtk-enable-animations property to disable all the built-in animations defined inside GTK without necessarily changing the global enable-animations key in the org.gnome.desktop.interface schema. Changing the GtkSettings property will affect only the current application; changing the global GSettings key will affect every GTK application, or the Shell.

2 Likes

Thank you very much for the quick and clear answer!