LinuxCommandLibrary

gsettings

Modify GNOME configuration settings

TLDR

Set the value of a key. Fails if the key doesn't exist or the value is out of range

$ gsettings set [org.example.schema] [example-key] [value]
copy

Print the value of a key or the schema-provided default if the key has not been set in dconf
$ gsettings get [org.example.schema] [example-key]
copy

Unset a key, so that its schema default value will be used
$ gsettings reset [org.example.schema] [example-key]
copy

Display all (non-relocatable) schemas, keys, and values
$ gsettings list-recursively
copy

Display all keys and values (default if not set) from one schema
$ gsettings list-recursively [org.example.schema]
copy

Display schema-allowed values for a key (helpful with enum keys)
$ gsettings range [org.example.schema] [example-key]
copy

Display the human-readable description of a key
$ gsettings describe [org.example.schema] [example-key]
copy

SYNOPSIS

gsettings [OPTIONS] COMMAND [ARGUMENTS]

PARAMETERS

list-schemas
    Lists all installed GSettings schemas.

list-keys SCHEMA
    Lists the keys (settings) available within a specified SCHEMA.

list-children SCHEMA
    Lists the child schemas (sub-directories) of a given SCHEMA.

get SCHEMA KEY
    Retrieves the current value of the specified KEY within the SCHEMA.

set SCHEMA KEY VALUE
    Sets the value of the specified KEY in the SCHEMA to VALUE. The value must be in the correct GVariant format (e.g., 'true', 'false', '"string"', '123').

reset SCHEMA KEY
    Resets the specified KEY in the SCHEMA to its default value.

reset-recursively SCHEMA
    Resets all keys within the specified SCHEMA and its children to their default values.

monitor SCHEMA [KEY]
    Monitors changes to a specific KEY or all keys within a SCHEMA and prints updates to standard output.

writable SCHEMA KEY
    Checks if the specified KEY in the SCHEMA is writable by the current user. Returns 0 if writable, 1 otherwise.

range SCHEMA KEY
    Shows the valid range or enumeration for a specified KEY as defined in its schema.

--schemadir DIRECTORY
    Adds DIRECTORY to the list of paths where gsettings looks for schemas.

--help
    Displays a help message for the command.

--version
    Displays version information for gsettings.

DESCRIPTION

gsettings is a command-line utility for interacting with the GSettings configuration system. GSettings provides a convenient way for applications to store and retrieve their configuration settings, primarily used within the GNOME desktop environment and applications built with GTK.

It's built on top of the dconf backend, which is a low-level configuration system that stores settings in a binary database. Users can use gsettings to query the current value of a setting, change it, or reset it to its default. It allows exploration of available schemas and keys, making it a powerful tool for system administrators and power users to customize application behavior without using graphical interfaces. Settings are organized hierarchically by schema, providing a structured approach to configuration management.

CAVEATS

Changes made via gsettings are typically applied immediately to running applications that monitor those settings. Users can only modify settings for which they have the necessary permissions, usually user-specific settings. Invalid values for settings will be rejected based on the schema's type definitions.

SCHEMA FILES

GSettings schemas are defined in XML files, typically located in /usr/share/glib-2.0/schemas/ or other directories specified in XDG_DATA_DIRS. These files are compiled into a binary cache (gschemas.compiled) for efficient lookup.

BACKEND INTERACTION

While gsettings is the user-facing command, it relies on the dconf backend for actual data storage and retrieval. dconf utilizes a binary database, usually located at ~/.config/dconf/user for user-specific settings.

SYSTEM-WIDE VS. USER SETTINGS

gsettings primarily interacts with user-specific settings. System-wide default settings and mandatory policies can be configured through dconf profiles and keyfiles found in /etc/dconf/db/.

HISTORY

GSettings was introduced as part of the GNOME 3 desktop environment, replacing the older GConf configuration system. The transition aimed to provide a more robust, performant, and D-Bus integrated configuration backend, leveraging dconf for efficient storage. While GConf stored settings in XML files, which could lead to performance issues, GSettings addresses these by using a binary database (dconf) and a transactional approach, offering better consistency and scalability for application configuration.

SEE ALSO

dconf(1), dbus-daemon(1), gschemata(1)

Copied to clipboard