Struct gtk4::Settings [−][src]
pub struct Settings(_);
Expand description
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.
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 Settings
object with g_object_set()
. This should be restricted
to special cases though; Settings
are not meant as an application
configuration facility.
There is one Settings
instance per display. It can be obtained with
for_display()
, but in many cases, it is more
convenient to use WidgetExt::settings()
.
Implements
Implementations
Creates a new builder-pattern struct instance to construct Settings
objects.
This method returns an instance of SettingsBuilder
which can be used to create Settings
objects.
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.
name
the name of the setting to reset
Whether buttons in dialogs should use the alternative button order.
Whether buttons in dialogs should use the alternative button order.
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.
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.
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…).
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…).
The aspect ratio of the text caret.
The aspect ratio of the text caret.
Whether the cursor should blink.
Also see the property::Settings::gtk-cursor-blink-timeout
setting,
which allows more flexible control over cursor blinking.
Whether the cursor should blink.
Also see the property::Settings::gtk-cursor-blink-timeout
setting,
which allows more flexible control over cursor blinking.
Length of the cursor blink cycle, in milliseconds.
Length of the cursor blink cycle, in milliseconds.
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::Settings::gtk-cursor-blink
to false
.
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::Settings::gtk-cursor-blink
to false
.
Name of the cursor theme to use.
Use None
to use the default theme.
Name of the cursor theme to use.
Use None
to use the default theme.
The size to use for cursors.
0 means to use the default size.
The size to use for cursors.
0 means to use the default size.
Determines which buttons should be put in the titlebar of client-side decorated windows, and whether they should be placed at the left of 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::HeaderBar::decoration-layout
property.
Determines which buttons should be put in the titlebar of client-side decorated windows, and whether they should be placed at the left of 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::HeaderBar::decoration-layout
property.
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 Dialog
directly, or message dialogs.
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 Dialog
directly, or message dialogs.
The number of pixels the cursor can move before dragging.
The number of pixels the cursor can move before dragging.
The maximum distance allowed between two clicks for them to be considered a double click, in pixels.
The maximum distance allowed between two clicks for them to be considered a double click, in pixels.
The maximum time to allow between two clicks for them to be considered a double click, in milliseconds.
The maximum time to allow between two clicks for them to be considered a double click, in milliseconds.
Whether menu items should have visible accelerators which can be activated.
Whether menu items should have visible accelerators which can be activated.
Whether to enable toolkit-wide animations.
Whether to enable toolkit-wide animations.
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.
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.
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.
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.
Whether a middle click on a mouse should paste the ‘PRIMARY’ clipboard content at the cursor location.
Whether a middle click on a mouse should paste the ‘PRIMARY’ clipboard content at the cursor location.
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.
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.
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.
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.
The default font to use.
GTK uses the family name and size from this string.
The default font to use.
GTK uses the family name and size from this string.
Timestamp of the curent fontconfig configuration.
Timestamp of the curent fontconfig configuration.
Name of the icon theme to use.
See IconTheme
for details about how
GTK handles icon themes.
Name of the icon theme to use.
See IconTheme
for details about how
GTK handles icon themes.
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 IMContext
.
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 IMContext
.
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.
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.
Whether to select the contents of a selectable label when it is focused.
Whether to select the contents of a selectable label when it is focused.
The time for a button or touch press to be considered a “long press”.
See GestureLongPress
.
The time for a button or touch press to be considered a “long press”.
See GestureLongPress
.
Whether scrolled windows may use overlaid scrolling indicators.
If this is set to false
, scrolled windows will have permanent
scrollbars.
Whether scrolled windows may use overlaid scrolling indicators.
If this is set to false
, scrolled windows will have permanent
scrollbars.
If the value of this setting is true
, clicking the primary button in a
Range
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.
If the value of this setting is true
, clicking the primary button in a
Range
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.
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”.
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”.
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 PrintSettings::to_file()
.
The preview application is responsible for removing the pdf file and the print settings file when it is done.
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 PrintSettings::to_file()
.
The preview application is responsible for removing the pdf file and the print settings file when it is done.
Whether GTK should keep track of items inside the recently used resources list.
If set to false
, the list will always be empty.
Whether GTK should keep track of items inside the recently used resources list.
If set to false
, the list will always be empty.
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.
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.
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.
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.
Whether two cursors should be displayed for mixed left-to-right and right-to-left text.
Whether two cursors should be displayed for mixed left-to-right and right-to-left text.
Name of the theme to load.
See CssProvider
for details about how
GTK finds the CSS stylesheet for a theme.
Name of the theme to load.
See CssProvider
for details about how
GTK finds the CSS stylesheet for a theme.
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.
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.
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.
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.
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.
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.
Whether to antialias fonts.
The values are 0 for no, 1 for yes, or -1 for the system default.
Whether to antialias fonts.
The values are 0 for no, 1 for yes, or -1 for the system default.
The font resolution, in 1024 * dots/inch.
-1 to use the default value.
The font resolution, in 1024 * dots/inch.
-1 to use the default value.
Whether to enable font hinting.
The values are 0 for no, 1 for yes, or -1 for the system default.
Whether to enable font hinting.
The values are 0 for no, 1 for yes, or -1 for the system default.
What degree of font hinting to use.
The possible vaues are hintnone, hintslight, hintmedium, hintfull.
What degree of font hinting to use.
The possible vaues are hintnone, hintslight, hintmedium, hintfull.
The type of subpixel antialiasing to use.
The possible values are none, rgb, bgr, vrgb, vbgr.
The type of subpixel antialiasing to use.
The possible values are none, rgb, bgr, vrgb, vbgr.
Gets the Settings
object for the default display, creating
it if necessary.
See for_display()
.
Returns
a Settings
object. If there is
no default display, then returns None
.
pub fn connect_gtk_alternative_sort_arrows_notify<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId
pub fn connect_gtk_application_prefer_dark_theme_notify<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId
pub fn connect_gtk_cursor_aspect_ratio_notify<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId
pub fn connect_gtk_cursor_blink_notify<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId
pub fn connect_gtk_cursor_blink_time_notify<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId
pub fn connect_gtk_cursor_blink_timeout_notify<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId
pub fn connect_gtk_cursor_theme_name_notify<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId
pub fn connect_gtk_cursor_theme_size_notify<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId
pub fn connect_gtk_decoration_layout_notify<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId
pub fn connect_gtk_dialogs_use_header_notify<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId
pub fn connect_gtk_dnd_drag_threshold_notify<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId
pub fn connect_gtk_double_click_distance_notify<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId
pub fn connect_gtk_double_click_time_notify<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId
pub fn connect_gtk_enable_accels_notify<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId
pub fn connect_gtk_enable_animations_notify<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId
pub fn connect_gtk_enable_event_sounds_notify<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId
pub fn connect_gtk_enable_input_feedback_sounds_notify<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId
pub fn connect_gtk_enable_primary_paste_notify<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId
pub fn connect_gtk_entry_password_hint_timeout_notify<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId
pub fn connect_gtk_entry_select_on_focus_notify<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId
pub fn connect_gtk_fontconfig_timestamp_notify<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId
pub fn connect_gtk_icon_theme_name_notify<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId
pub fn connect_gtk_label_select_on_focus_notify<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId
pub fn connect_gtk_long_press_time_notify<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId
pub fn connect_gtk_overlay_scrolling_notify<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId
pub fn connect_gtk_print_backends_notify<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId
pub fn connect_gtk_print_preview_command_notify<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId
pub fn connect_gtk_recent_files_enabled_notify<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId
pub fn connect_gtk_recent_files_max_age_notify<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId
pub fn connect_gtk_shell_shows_desktop_notify<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId
pub fn connect_gtk_sound_theme_name_notify<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId
pub fn connect_gtk_split_cursor_notify<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId
pub fn connect_gtk_titlebar_double_click_notify<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId
pub fn connect_gtk_titlebar_middle_click_notify<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId
pub fn connect_gtk_titlebar_right_click_notify<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId
pub fn connect_gtk_xft_antialias_notify<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId
pub fn connect_gtk_xft_hintstyle_notify<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId
Trait Implementations
This method returns an ordering between self
and other
values if one exists. Read more
This method tests less than (for self
and other
) and is used by the <
operator. Read more
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
Returns the type identifier of Self
.
Auto Trait Implementations
impl RefUnwindSafe for Settings
impl UnwindSafe for Settings
Blanket Implementations
Mutably borrows from an owned value. Read more
Upcasts an object to a superclass or interface T
. Read more
Upcasts an object to a reference of its superclass or interface T
. Read more
Tries to downcast to a subclass or interface implementor T
. Read more
Tries to downcast to a reference of its subclass or interface implementor T
. Read more
Tries to cast to an object of type T
. This handles upcasting, downcasting
and casting between interface and interface implementors. All checks are performed at
runtime, while downcast
and upcast
will do many checks at compile-time already. Read more
Tries to cast to reference to an object of type T
. This handles upcasting, downcasting
and casting between interface and interface implementors. All checks are performed at
runtime, while downcast
and upcast
will do many checks at compile-time already. Read more
Casts to T
unconditionally. Read more
Casts to &T
unconditionally. Read more
Returns true
if the object is an instance of (can be cast to) T
.
pub fn set_property<'a, N, V>(
&self,
property_name: N,
value: V
) -> Result<(), BoolError> where
N: Into<&'a str>,
V: ToValue,
pub fn set_property_from_value<'a, N>(
&self,
property_name: N,
value: &Value
) -> Result<(), BoolError> where
N: Into<&'a str>,
pub fn set_properties_from_value(
&self,
property_values: &[(&str, Value)]
) -> Result<(), BoolError>
pub fn has_property<'a, N>(&self, property_name: N, type_: Option<Type>) -> bool where
N: Into<&'a str>,
pub fn find_property<'a, N>(&self, property_name: N) -> Option<ParamSpec> where
N: Into<&'a str>,
Safety Read more
Safety Read more
Safety Read more
Safety Read more
pub fn connect<'a, N, F>(
&self,
signal_name: N,
after: bool,
callback: F
) -> Result<SignalHandlerId, BoolError> where
N: Into<&'a str>,
F: 'static + Fn(&[Value]) -> Option<Value> + Send + Sync,
Same as connect
but takes a SignalId
instead of a signal name.
pub fn connect_local<'a, N, F>(
&self,
signal_name: N,
after: bool,
callback: F
) -> Result<SignalHandlerId, BoolError> where
N: Into<&'a str>,
F: 'static + Fn(&[Value]) -> Option<Value>,
Same as connect_local
but takes a SignalId
instead of a signal name.
pub unsafe fn connect_unsafe<'a, N, F>(
&self,
signal_name: N,
after: bool,
callback: F
) -> Result<SignalHandlerId, BoolError> where
N: Into<&'a str>,
F: Fn(&[Value]) -> Option<Value>,
Same as connect_unsafe
but takes a SignalId
instead of a signal name.
Emit signal by signal id.
Same as emit
but takes Value
for the arguments.
Emit signal by its name.
Same as emit_by_name
but takes Value
for the arguments.
Emit signal with details by signal id.
Same as emit_with_details
but takes Value
for the arguments.
pub fn connect_notify<F>(&self, name: Option<&str>, f: F) -> SignalHandlerId where
F: 'static + Fn(&T, &ParamSpec) + Send + Sync,
pub fn connect_notify_local<F>(
&self,
name: Option<&str>,
f: F
) -> SignalHandlerId where
F: 'static + Fn(&T, &ParamSpec),
pub unsafe fn connect_notify_unsafe<F>(
&self,
name: Option<&str>,
f: F
) -> SignalHandlerId where
F: Fn(&T, &ParamSpec),
pub fn bind_property<'a, O, N, M>(
&'a self,
source_property: N,
target: &'a O,
target_property: M
) -> BindingBuilder<'a> where
O: ObjectType,
N: Into<&'a str>,
M: Into<&'a str>,
Returns a SendValue
clone of self
.