It derives from <GObject>.
Provides a mechanism to share global settings between applications.
GTK relies on the platform-specific API for getting desktop-wide settings.
On Wayland, the settings are obtained via a settings portal that is part of the Linux desktop APIs for application.
On the X window system, this sharing is realized by an XSettings manager.
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
<GKeyFile>), 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 <GtkSettings> object with
g_object_set(). This should be restricted to special cases
though; <GtkSettings> are not meant as an
application configuration facility.
There is one <GtkSettings> instance per display.
It can be obtained with settings:get-for-display, but in many cases, it is
more convenient to use widget:get-settings.
Whether buttons in dialogs should use the alternative button order.
Its value is a boolean.
Set it with (set! (settings:gtk-alternative-button-order self)
value).
Controls the direction of the sort indicators in sorted list and tree views.
By default an arrow pointing down means the column is sorted in
ascending order. When set to #t, this order will be inverted.
Its value is a boolean.
Set it with (set! (settings:gtk-alternative-sort-arrows self)
value).
Whether the application prefers to use a dark theme.
If a GTK theme includes a dark variant, it will be used instead of the configured theme.
Some applications benefit from minimizing the amount of light pollution that interferes with the content. Good candidates for dark themes are photo and video editors that make the actual content get all the attention and minimize the distraction of the chrome.
Dark themes should not be used for documents, where large spaces are white/light and the dark chrome creates too much contrast (web browser, text editor...).
Its value is a boolean.
Set it with (set! (settings:gtk-application-prefer-dark-theme
self) value).
The aspect ratio of the text caret.
Its value is a real number.
Set it with (set! (settings:gtk-cursor-aspect-ratio self) value).
Whether the cursor should blink.
Also see the settings:gtk-cursor-blink-timeout setting,
which allows more flexible control over cursor blinking.
Its value is a boolean.
Set it with (set! (settings:gtk-cursor-blink self) value).
Length of the cursor blink cycle, in milliseconds.
Its value is a 32-bit integer.
Set it with (set! (settings:gtk-cursor-blink-time self) value).
Time after which the cursor stops blinking, in seconds.
The timer is reset after each user interaction.
Setting this to zero has the same effect as setting settings:gtk-cursor-blink to #f.
Its value is a 32-bit integer.
Set it with (set! (settings:gtk-cursor-blink-timeout self)
value).
Name of the cursor theme to use.
Use #f to use the default theme.
Its value is a string, or #f.
Set it with (set! (settings:gtk-cursor-theme-name self) value).
The size to use for cursors.
0 means to use the default size.
Its value is a 32-bit integer.
Set it with (set! (settings:gtk-cursor-theme-size self) value).
Determines which buttons should be put in the titlebar of client-side decorated windows, and whether they should be placed on the left or right.
The format of the string is button names, separated by commas. A colon separates the buttons that should appear on the left from those on the right. Recognized button names are minimize, maximize, close, icon (the window icon) and menu (a menu button for the fallback app menu).
For example, "menu:minimize,maximize,close" specifies a menu on the left, and minimize, maximize and close buttons on the right.
Note that buttons will only be shown when they are meaningful. E.g. a menu button only appears when the desktop shell does not show the app menu, and a close button only appears on a window that can be closed.
Also note that the setting can be overridden with the
header-bar:decoration-layout property.
Its value is a string, or #f.
Set it with (set! (settings:gtk-decoration-layout self) value).
Whether builtin GTK dialogs such as the file chooser, the color chooser or the font chooser will use a header bar at the top to show action widgets, or an action area at the bottom.
This setting does not affect custom dialogs using GtkDialog
directly, or message dialogs.
Its value is a boolean.
Set it with (set! (settings:gtk-dialogs-use-header self) value).
The number of pixels the cursor can move before dragging.
Its value is a 32-bit integer.
Set it with (set! (settings:gtk-dnd-drag-threshold self) value).
The maximum distance allowed between two clicks for them to be considered a double click, in pixels.
Its value is a 32-bit integer.
Set it with (set! (settings:gtk-double-click-distance self)
value).
The maximum time to allow between two clicks for them to be considered a double click, in milliseconds.
Its value is a 32-bit integer.
Set it with (set! (settings:gtk-double-click-time self) value).
Whether menu items should have visible accelerators which can be activated.
Its value is a boolean.
Set it with (set! (settings:gtk-enable-accels self) value).
Whether to enable toolkit-wide animations.
Its value is a boolean.
Set it with (set! (settings:gtk-enable-animations self) value).
Whether to play any event sounds at all.
See the Sound Theme Specifications for more information on event sounds and sound themes.
GTK itself does not support event sounds, you have to use a loadable module like the one that comes with libcanberra.
Its value is a boolean.
Set it with (set! (settings:gtk-enable-event-sounds self) value).
Whether to play event sounds as feedback to user input.
See the Sound Theme Specifications for more information on event sounds and sound themes.
GTK itself does not support event sounds, you have to use a loadable module like the one that comes with libcanberra.
Its value is a boolean.
Set it with (set! (settings:gtk-enable-input-feedback-sounds self)
value).
Whether a middle click on a mouse should paste the ’PRIMARY’ clipboard content at the cursor location.
Its value is a boolean.
Set it with (set! (settings:gtk-enable-primary-paste self)
value).
How long to show the last input character in hidden entries.
This value is in milliseconds. 0 disables showing the last char. 600 is a good value for enabling it.
Its value is an unsigned 32-bit integer.
Set it with (set! (settings:gtk-entry-password-hint-timeout self)
value).
Whether to select the contents of an entry when it is focused.
Its value is a boolean.
Set it with (set! (settings:gtk-entry-select-on-focus self)
value).
When #t, keyboard navigation and other input-related errors will
cause a beep.
Since the error bell is implemented using surface:beep, the windowing system may offer ways to
configure the error bell in many ways, such as flashing the window or
similar visual effects.
Its value is a boolean.
Set it with (set! (settings:gtk-error-bell self) value).
The default font to use.
GTK uses the family name and size from this string.
Its value is a string, or #f.
Set it with (set! (settings:gtk-font-name self) value).
How GTK font rendering is set up.
When set to Gtk.FontRendering.MANUAL, GTK respects the low-level
font-related settings (settings:gtk-hint-font-metrics,
settings:gtk-xft-antialias, settings:gtk-xft-hinting,
settings:gtk-xft-hintstyle and settings:gtk-xft-rgba) as much as practical.
When set to Gtk.FontRendering.AUTOMATIC, GTK will consider
factors such as screen resolution and scale in deciding how to render
fonts.
Its value is a <GtkFontRendering> (or, to
set it, one of its symbols).
Set it with (set! (settings:gtk-font-rendering self) value).
Timestamp of the current fontconfig configuration.
Its value is an unsigned 32-bit integer.
Set it with (set! (settings:gtk-fontconfig-timestamp self)
value).
Whether hinting should be applied to font metrics.
Note that this also turns off subpixel positioning of glyphs, since it conflicts with metrics hinting.
Its value is a boolean.
Set it with (set! (settings:gtk-hint-font-metrics self) value).
Name of the icon theme to use.
See <GtkIconTheme> for details about how GTK
handles icon themes.
Its value is a string, or #f.
Set it with (set! (settings:gtk-icon-theme-name self) value).
Which IM (input method) module should be used by default.
This is the input method that will be used if the user has not explicitly chosen another input method from the IM context menu. This also can be a colon-separated list of input methods, which GTK will try in turn until it finds one available on the system.
See <GtkIMContext>.
Its value is a string, or #f.
Set it with (set! (settings:gtk-im-module self) value).
The color scheme used for rendering the user interface.
This setting communicates the system-wide preference. The color scheme
that is actually used when applying CSS styles can be set with the
css-provider:prefers-color-scheme property.
Its value is a
<GtkInterfaceColorScheme> (or, to set
it, one of its symbols).
Set it with (set! (settings:gtk-interface-color-scheme self)
value).
The level of contrast to use for the user interface.
This setting communicates the system-wide preference. The contrast
level that is actually used when applying CSS styles can be set with the
css-provider:prefers-contrast property.
Its value is a <GtkInterfaceContrast>
(or, to set it, one of its symbols).
Set it with (set! (settings:gtk-interface-contrast self) value).
Whether animations should be reduced to essential motions.
This setting communicates the system-wide preference. The motion level
that is actually used when applying CSS styles can be set with the
css-provider:prefers-reduced-motion property.
Its value is a <GtkReducedMotion> (or, to
set it, one of its symbols).
Set it with (set! (settings:gtk-interface-reduced-motion self)
value).
Whether GTK should make sure that text can be navigated with a caret, even if it is not editable.
This is useful when using a screen reader.
Its value is a boolean.
Set it with (set! (settings:gtk-keynav-use-caret self) value).
Whether to select the contents of a selectable label when it is focused.
Its value is a boolean.
Set it with (set! (settings:gtk-label-select-on-focus self)
value).
The time for a button or touch press to be considered a “long press”.
Its value is an unsigned 32-bit integer.
Set it with (set! (settings:gtk-long-press-time self) value).
Whether scrolled windows may use overlaid scrolling indicators.
If this is set to #f, scrolled windows will have permanent
scrollbars.
Its value is a boolean.
Set it with (set! (settings:gtk-overlay-scrolling self) value).
If the value of this setting is #t, clicking the primary button
in a <GtkRange> trough will move the slider, and
hence set the range’s value, to the point that you clicked.
If it is #f, a primary click will cause the slider/value to move
by the range’s page-size towards the point clicked.
Whichever action you choose for the primary button, the other action will be available by holding Shift and primary-clicking, or clicking the middle mouse button.
Its value is a boolean.
Set it with (set! (settings:gtk-primary-button-warps-slider self)
value).
A comma-separated list of print backends to use in the print dialog.
Available print backends depend on the GTK installation, and may include "file", "cups", "lpr" or "papi".
Its value is a string, or #f.
Set it with (set! (settings:gtk-print-backends self) value).
A command to run for displaying the print preview.
The command should contain a %f placeholder, which will get
replaced by the path to the pdf file. The command may also contain a
%s placeholder, which will get replaced by the path to a file
containing the print settings in the format produced by
print-settings:to-file?.
The preview application is responsible for removing the pdf file and the print settings file when it is done.
Its value is a string, or #f.
Set it with (set! (settings:gtk-print-preview-command self)
value).
Whether GTK should keep track of items inside the recently used resources list.
If set to #f, the list will always be empty.
Its value is a boolean.
Set it with (set! (settings:gtk-recent-files-enabled self)
value).
The maximum age, in days, of the items inside the recently used resources list.
Items older than this setting will be excised from the list. If set to 0, the list will always be empty; if set to -1, no item will be removed.
Its value is a 32-bit integer.
Set it with (set! (settings:gtk-recent-files-max-age self)
value).
Set to #t if the desktop environment is displaying the app menu,
#f if the app should display it itself.
Its value is a boolean.
Set it with (set! (settings:gtk-shell-shows-app-menu self)
value).
Set to #t if the desktop environment is displaying the desktop
folder, #f if not.
Its value is a boolean.
Set it with (set! (settings:gtk-shell-shows-desktop self) value).
Set to #t if the desktop environment is displaying the menubar,
#f if the app should display it itself.
Its value is a boolean.
Set it with (set! (settings:gtk-shell-shows-menubar self) value).
When #t, widgets like switches include shapes to indicate their
on/off state.
Its value is a boolean.
Set it with (set! (settings:gtk-show-status-shapes self) value).
The XDG sound theme to use for event sounds.
See the Sound Theme Specifications for more information on event sounds and sound themes.
GTK itself does not support event sounds, you have to use a loadable module like the one that comes with libcanberra.
Its value is a string, or #f.
Set it with (set! (settings:gtk-sound-theme-name self) value).
Whether two cursors should be displayed for mixed left-to-right and right-to-left text.
Its value is a boolean.
Set it with (set! (settings:gtk-split-cursor self) value).
Name of the theme to load.
See <GtkCssProvider> for details about how GTK
finds the CSS stylesheet for a theme.
Its value is a string, or #f.
Set it with (set! (settings:gtk-theme-name self) value).
Determines the action to take when a double-click occurs on the titlebar of client-side decorated windows.
Recognized actions are minimize, toggle-maximize, menu, lower or none.
Its value is a string, or #f.
Set it with (set! (settings:gtk-titlebar-double-click self)
value).
Determines the action to take when a middle-click occurs on the titlebar of client-side decorated windows.
Recognized actions are minimize, toggle-maximize, menu, lower or none.
Its value is a string, or #f.
Set it with (set! (settings:gtk-titlebar-middle-click self)
value).
Determines the action to take when a right-click occurs on the titlebar of client-side decorated windows.
Recognized actions are minimize, toggle-maximize, menu, lower or none.
Its value is a string, or #f.
Set it with (set! (settings:gtk-titlebar-right-click self)
value).
Whether to antialias fonts.
The values are 0 for no, 1 for yes, or -1 for the system default.
Its value is a 32-bit integer.
Set it with (set! (settings:gtk-xft-antialias self) value).
The font resolution, in 1024 * dots/inch.
-1 to use the default value.
Its value is a 32-bit integer.
Set it with (set! (settings:gtk-xft-dpi self) value).
Whether to enable font hinting.
The values are 0 for no, 1 for yes, or -1 for the system default.
Its value is a 32-bit integer.
Set it with (set! (settings:gtk-xft-hinting self) value).
What degree of font hinting to use.
The possible vaues are hintnone, hintslight, hintmedium, hintfull.
Its value is a string, or #f.
Set it with (set! (settings:gtk-xft-hintstyle self) value).
The type of subpixel antialiasing to use.
The possible values are none, rgb, bgr, vrgb, vbgr.
Note that GSK does not support subpixel antialiasing, and this setting has no effect on font rendering in GTK.
Its value is a string, or #f.
Set it with (set! (settings:gtk-xft-rgba self) value).
Gets the <GtkSettings> object for the default
display, creating it if necessary.
Returned: a <GtkSettings>, or #f.
a <GtkSettings> object. If there is no default
display, then returns #f.
Gets the <GtkSettings> object for display,
creating it if necessary.
Passed: a <GdkDisplay>.
Returned: a <GtkSettings>.
a <GtkSettings> object
Undoes the effect of calling g_object_set() to install an
application-specific value for a setting.
After this call, the setting will again follow the session-wide value for this setting.
Passed: a <GtkSettings>.
a <GtkSettings> object
Passed: a string.
the name of the setting to reset