gtk.settings.Settings provides a mechanism to share global settings between
applications.
On the X window system, this sharing is realized by an
XSettings
manager that is usually part of the desktop environment, along with
utilities that let the user change these settings.
On Wayland, the settings are obtained either via a settings portal,
or by reading desktop settings from DConf.
On macOS, the settings are obtained from NSUserDefaults.
In the absence of these sharing mechanisms, GTK reads default values for
settings from settings.ini files in /etc/gtk-4.0, $XDG_CONFIG_DIRS/gtk-4.0
and $XDG_CONFIG_HOME/gtk-4.0. These files must be valid key files (see
glib.key_file.KeyFile), and have a section called Settings. Themes can also provide
default values for settings by installing a settings.ini file
next to their gtk.css file.
gtk.settings.Settings provides a mechanism to share global settings between applications.
On the X window system, this sharing is realized by an XSettings
manager that is usually part of the desktop environment, along with utilities that let the user change these settings.
On Wayland, the settings are obtained either via a settings portal, or by reading desktop settings from DConf.
On macOS, the settings are obtained from NSUserDefaults.
In the absence of these sharing mechanisms, GTK reads default values for settings from settings.ini files in /etc/gtk-4.0, $XDG_CONFIG_DIRS/gtk-4.0 and $XDG_CONFIG_HOME/gtk-4.0. These files must be valid key files (see glib.key_file.KeyFile), and have a section called Settings. Themes can also provide default values for settings by installing a settings.ini file next to their gtk.css file.
Applications can override system-wide settings by setting the property of the gtk.settings.Settings object with gobject.object.ObjectG.set. This should be restricted to special cases though; gtk.settings.Settings are not meant as an application configuration facility.
There is one gtk.settings.Settings instance per display. It can be obtained with gtk.settings.Settings.getForDisplay, but in many cases, it is more convenient to use gtk.widget.Widget.getSettings.