Gtk.Settings

g GObject.GInterface GObject.GInterface Gtk.StyleProvider Gtk.StyleProvider GObject.GInterface->Gtk.StyleProvider GObject.Object GObject.Object Gtk.Settings Gtk.Settings GObject.Object->Gtk.Settings Gtk.StyleProvider->Gtk.Settings

Subclasses:

None

Methods

Inherited:

GObject.Object (37)

Structs:

GObject.ObjectClass (5)

class

get_default ()

class

get_for_display (display)

reset_property (name)

Virtual Methods

Inherited:

GObject.Object (7)

Properties

Name

Type

Flags

Short Description

gtk-alternative-button-order

bool

r/w

gtk-alternative-sort-arrows

bool

r/w

gtk-application-prefer-dark-theme

bool

r/w

gtk-cursor-aspect-ratio

float

r/w

gtk-cursor-blink

bool

r/w

gtk-cursor-blink-time

int

r/w

gtk-cursor-blink-timeout

int

r/w

gtk-cursor-theme-name

str

r/w

gtk-cursor-theme-size

int

r/w

gtk-decoration-layout

str

r/w

gtk-dialogs-use-header

bool

r/w

gtk-dnd-drag-threshold

int

r/w

gtk-double-click-distance

int

r/w

gtk-double-click-time

int

r/w

gtk-enable-accels

bool

r/w

gtk-enable-animations

bool

r/w

gtk-enable-event-sounds

bool

r/w

gtk-enable-input-feedback-sounds

bool

r/w

gtk-enable-primary-paste

bool

r/w

gtk-entry-password-hint-timeout

int

r/w

gtk-entry-select-on-focus

bool

r/w

gtk-error-bell

bool

r/w

gtk-font-name

str

r/w

gtk-fontconfig-timestamp

int

r/w

gtk-hint-font-metrics

bool

r/w

gtk-icon-theme-name

str

r/w

gtk-im-module

str

r/w

gtk-keynav-use-caret

bool

r/w

gtk-label-select-on-focus

bool

r/w

gtk-long-press-time

int

r/w

gtk-overlay-scrolling

bool

r/w

gtk-primary-button-warps-slider

bool

r/w

gtk-print-backends

str

r/w

gtk-print-preview-command

str

r/w

gtk-recent-files-enabled

bool

r/w

gtk-recent-files-max-age

int

r/w

gtk-shell-shows-app-menu

bool

r/w

gtk-shell-shows-desktop

bool

r/w

gtk-shell-shows-menubar

bool

r/w

gtk-sound-theme-name

str

r/w

gtk-split-cursor

bool

r/w

gtk-theme-name

str

r/w

gtk-titlebar-double-click

str

r/w

gtk-titlebar-middle-click

str

r/w

gtk-titlebar-right-click

str

r/w

gtk-xft-antialias

int

r/w

gtk-xft-dpi

int

r/w

gtk-xft-hinting

int

r/w

gtk-xft-hintstyle

str

r/w

gtk-xft-rgba

str

r/w

Signals

Inherited:

GObject.Object (1), Gtk.StyleProvider (1)

Fields

Inherited:

GObject.Object (1), Gtk.StyleProvider (1)

Class Details

class Gtk.Settings(**kwargs)
Bases:

GObject.Object, Gtk.StyleProvider

Abstract:

No

GtkSettings 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.

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 [func`Gtk`.Settings.get_for_display], but in many cases, it is more convenient to use [method`Gtk`.Widget.get_settings].

classmethod get_default()[source]
Returns:

a GtkSettings object. If there is no default display, then returns None.

Return type:

Gtk.Settings or None

Gets the GtkSettings object for the default display, creating it if necessary.

See [func`Gtk`.Settings.get_for_display].

classmethod get_for_display(display)[source]
Parameters:

display (Gdk.Display) – a GdkDisplay

Returns:

a GtkSettings object

Return type:

Gtk.Settings

Gets the GtkSettings object for display, creating it if necessary.

reset_property(name)[source]
Parameters:

name (str) – the name of the setting to reset

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.

Property Details

Gtk.Settings.props.gtk_alternative_button_order
Name:

gtk-alternative-button-order

Type:

bool

Default Value:

False

Flags:

READABLE, WRITABLE

Whether buttons in dialogs should use the alternative button order.

Gtk.Settings.props.gtk_alternative_sort_arrows
Name:

gtk-alternative-sort-arrows

Type:

bool

Default Value:

False

Flags:

READABLE, WRITABLE

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 True, this order will be inverted.

Gtk.Settings.props.gtk_application_prefer_dark_theme
Name:

gtk-application-prefer-dark-theme

Type:

bool

Default Value:

False

Flags:

READABLE, WRITABLE

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…).

Gtk.Settings.props.gtk_cursor_aspect_ratio
Name:

gtk-cursor-aspect-ratio

Type:

float

Default Value:

0.04

Flags:

READABLE, WRITABLE

The aspect ratio of the text caret.

Name:

gtk-cursor-blink

Type:

bool

Default Value:

True

Flags:

READABLE, WRITABLE

Whether the cursor should blink.

Also see the [property`Gtk`.Settings:gtk-cursor-blink-timeout] setting, which allows more flexible control over cursor blinking.

Name:

gtk-cursor-blink-time

Type:

int

Default Value:

1200

Flags:

READABLE, WRITABLE

Length of the cursor blink cycle, in milliseconds.

Name:

gtk-cursor-blink-timeout

Type:

int

Default Value:

10

Flags:

READABLE, WRITABLE

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 [property`Gtk`.Settings:gtk-cursor-blink] to False.

Gtk.Settings.props.gtk_cursor_theme_name
Name:

gtk-cursor-theme-name

Type:

str

Default Value:

None

Flags:

READABLE, WRITABLE

Name of the cursor theme to use.

Use None to use the default theme.

Gtk.Settings.props.gtk_cursor_theme_size
Name:

gtk-cursor-theme-size

Type:

int

Default Value:

0

Flags:

READABLE, WRITABLE

The size to use for cursors.

0 means to use the default size.

Gtk.Settings.props.gtk_decoration_layout
Name:

gtk-decoration-layout

Type:

str

Default Value:

'menu:minimize,maximize,close'

Flags:

READABLE, WRITABLE

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 [property`Gtk`.HeaderBar:decoration-layout] property.

Gtk.Settings.props.gtk_dialogs_use_header
Name:

gtk-dialogs-use-header

Type:

bool

Default Value:

False

Flags:

READABLE, WRITABLE

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.

Gtk.Settings.props.gtk_dnd_drag_threshold
Name:

gtk-dnd-drag-threshold

Type:

int

Default Value:

8

Flags:

READABLE, WRITABLE

The number of pixels the cursor can move before dragging.

Gtk.Settings.props.gtk_double_click_distance
Name:

gtk-double-click-distance

Type:

int

Default Value:

5

Flags:

READABLE, WRITABLE

The maximum distance allowed between two clicks for them to be considered a double click, in pixels.

Gtk.Settings.props.gtk_double_click_time
Name:

gtk-double-click-time

Type:

int

Default Value:

400

Flags:

READABLE, WRITABLE

The maximum time to allow between two clicks for them to be considered a double click, in milliseconds.

Gtk.Settings.props.gtk_enable_accels
Name:

gtk-enable-accels

Type:

bool

Default Value:

True

Flags:

READABLE, WRITABLE

Whether menu items should have visible accelerators which can be activated.

Gtk.Settings.props.gtk_enable_animations
Name:

gtk-enable-animations

Type:

bool

Default Value:

True

Flags:

READABLE, WRITABLE

Whether to enable toolkit-wide animations.

Gtk.Settings.props.gtk_enable_event_sounds
Name:

gtk-enable-event-sounds

Type:

bool

Default Value:

True

Flags:

READABLE, WRITABLE

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.

Gtk.Settings.props.gtk_enable_input_feedback_sounds
Name:

gtk-enable-input-feedback-sounds

Type:

bool

Default Value:

True

Flags:

READABLE, WRITABLE

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.

Gtk.Settings.props.gtk_enable_primary_paste
Name:

gtk-enable-primary-paste

Type:

bool

Default Value:

True

Flags:

READABLE, WRITABLE

Whether a middle click on a mouse should paste the ‘PRIMARY’ clipboard content at the cursor location.

Gtk.Settings.props.gtk_entry_password_hint_timeout
Name:

gtk-entry-password-hint-timeout

Type:

int

Default Value:

0

Flags:

READABLE, WRITABLE

How long to show the last input character in hidden entries.

This value is in milliseconds. 0 disables showing the last str. 600 is a good value for enabling it.

Gtk.Settings.props.gtk_entry_select_on_focus
Name:

gtk-entry-select-on-focus

Type:

bool

Default Value:

True

Flags:

READABLE, WRITABLE

Whether to select the contents of an entry when it is focused.

Gtk.Settings.props.gtk_error_bell
Name:

gtk-error-bell

Type:

bool

Default Value:

True

Flags:

READABLE, WRITABLE

When True, keyboard navigation and other input-related errors will cause a beep.

Since the error bell is implemented using Gdk.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.

Gtk.Settings.props.gtk_font_name
Name:

gtk-font-name

Type:

str

Default Value:

'Sans 10'

Flags:

READABLE, WRITABLE

The default font to use.

GTK uses the family name and size from this string.

Gtk.Settings.props.gtk_fontconfig_timestamp
Name:

gtk-fontconfig-timestamp

Type:

int

Default Value:

0

Flags:

READABLE, WRITABLE

Timestamp of the current fontconfig configuration.

Gtk.Settings.props.gtk_hint_font_metrics
Name:

gtk-hint-font-metrics

Type:

bool

Default Value:

False

Flags:

READABLE, WRITABLE

Whether hinting should be applied to font metrics.

Note that this also turns off subpixel positioning of glyphs, since it conflicts with metrics hinting.

New in version 4.6.

Gtk.Settings.props.gtk_icon_theme_name
Name:

gtk-icon-theme-name

Type:

str

Default Value:

'Adwaita'

Flags:

READABLE, WRITABLE

Name of the icon theme to use.

See [class`Gtk`.IconTheme] for details about how GTK handles icon themes.

Gtk.Settings.props.gtk_im_module
Name:

gtk-im-module

Type:

str

Default Value:

None

Flags:

READABLE, WRITABLE

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 [class`Gtk`.IMContext].

Gtk.Settings.props.gtk_keynav_use_caret
Name:

gtk-keynav-use-caret

Type:

bool

Default Value:

False

Flags:

READABLE, WRITABLE

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.

Gtk.Settings.props.gtk_label_select_on_focus
Name:

gtk-label-select-on-focus

Type:

bool

Default Value:

True

Flags:

READABLE, WRITABLE

Whether to select the contents of a selectable label when it is focused.

Gtk.Settings.props.gtk_long_press_time
Name:

gtk-long-press-time

Type:

int

Default Value:

500

Flags:

READABLE, WRITABLE

The time for a button or touch press to be considered a “long press”.

See [class`Gtk`.GestureLongPress].

Gtk.Settings.props.gtk_overlay_scrolling
Name:

gtk-overlay-scrolling

Type:

bool

Default Value:

True

Flags:

READABLE, WRITABLE

Whether scrolled windows may use overlaid scrolling indicators.

If this is set to False, scrolled windows will have permanent scrollbars.

Gtk.Settings.props.gtk_primary_button_warps_slider
Name:

gtk-primary-button-warps-slider

Type:

bool

Default Value:

True

Flags:

READABLE, WRITABLE

If the value of this setting is True, 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 False, 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.

Gtk.Settings.props.gtk_print_backends
Name:

gtk-print-backends

Type:

str

Default Value:

'cups,file'

Flags:

READABLE, WRITABLE

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”.

Gtk.Settings.props.gtk_print_preview_command
Name:

gtk-print-preview-command

Type:

str

Default Value:

'evince --unlink-tempfile --preview --print-settings %s %f'

Flags:

READABLE, WRITABLE

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 [method`Gtk`.PrintSettings.to_file].

The preview application is responsible for removing the pdf file and the print settings file when it is done.

Gtk.Settings.props.gtk_recent_files_enabled
Name:

gtk-recent-files-enabled

Type:

bool

Default Value:

True

Flags:

READABLE, WRITABLE

Whether GTK should keep track of items inside the recently used resources list.

If set to False, the list will always be empty.

Gtk.Settings.props.gtk_recent_files_max_age
Name:

gtk-recent-files-max-age

Type:

int

Default Value:

30

Flags:

READABLE, WRITABLE

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.

Gtk.Settings.props.gtk_shell_shows_app_menu
Name:

gtk-shell-shows-app-menu

Type:

bool

Default Value:

False

Flags:

READABLE, WRITABLE

Set to True if the desktop environment is displaying the app menu, False if the app should display it itself.

Gtk.Settings.props.gtk_shell_shows_desktop
Name:

gtk-shell-shows-desktop

Type:

bool

Default Value:

True

Flags:

READABLE, WRITABLE

Set to True if the desktop environment is displaying the desktop folder, False if not.

Gtk.Settings.props.gtk_shell_shows_menubar
Name:

gtk-shell-shows-menubar

Type:

bool

Default Value:

False

Flags:

READABLE, WRITABLE

Set to True if the desktop environment is displaying the menubar, False if the app should display it itself.

Gtk.Settings.props.gtk_sound_theme_name
Name:

gtk-sound-theme-name

Type:

str

Default Value:

'freedesktop'

Flags:

READABLE, WRITABLE

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.

Gtk.Settings.props.gtk_split_cursor
Name:

gtk-split-cursor

Type:

bool

Default Value:

False

Flags:

READABLE, WRITABLE

Whether two cursors should be displayed for mixed left-to-right and right-to-left text.

Gtk.Settings.props.gtk_theme_name
Name:

gtk-theme-name

Type:

str

Default Value:

'Default'

Flags:

READABLE, WRITABLE

Name of the theme to load.

See [class`Gtk`.CssProvider] for details about how GTK finds the CSS stylesheet for a theme.

Gtk.Settings.props.gtk_titlebar_double_click
Name:

gtk-titlebar-double-click

Type:

str

Default Value:

'toggle-maximize'

Flags:

READABLE, WRITABLE

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.

Gtk.Settings.props.gtk_titlebar_middle_click
Name:

gtk-titlebar-middle-click

Type:

str

Default Value:

'none'

Flags:

READABLE, WRITABLE

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.

Gtk.Settings.props.gtk_titlebar_right_click
Name:

gtk-titlebar-right-click

Type:

str

Default Value:

'menu'

Flags:

READABLE, WRITABLE

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.

Gtk.Settings.props.gtk_xft_antialias
Name:

gtk-xft-antialias

Type:

int

Default Value:

-1

Flags:

READABLE, WRITABLE

Whether to antialias fonts.

The values are 0 for no, 1 for yes, or -1 for the system default.

Gtk.Settings.props.gtk_xft_dpi
Name:

gtk-xft-dpi

Type:

int

Default Value:

-1

Flags:

READABLE, WRITABLE

The font resolution, in 1024 * dots/inch.

-1 to use the default value.

Gtk.Settings.props.gtk_xft_hinting
Name:

gtk-xft-hinting

Type:

int

Default Value:

-1

Flags:

READABLE, WRITABLE

Whether to enable font hinting.

The values are 0 for no, 1 for yes, or -1 for the system default.

Gtk.Settings.props.gtk_xft_hintstyle
Name:

gtk-xft-hintstyle

Type:

str

Default Value:

None

Flags:

READABLE, WRITABLE

What degree of font hinting to use.

The possible vaues are hintnone, hintslight, hintmedium, hintfull.

Gtk.Settings.props.gtk_xft_rgba
Name:

gtk-xft-rgba

Type:

str

Default Value:

None

Flags:

READABLE, WRITABLE

The type of subpixel antialiasing to use.

The possible values are none, rgb, bgr, vrgb, vbgr.