dconf-write
Write a value to a dconf setting
TLDR
Write a specific key value
Write a specific string key value
Write a specific integer key value
Write a specific boolean key value
Write a specific array key value
Write a specific empty array key value
SYNOPSIS
dconf write [OPTION...] KEY VALUE
PARAMETERS
KEY
The full, absolute path to the dconf key to be modified (e.g., /org/gnome/desktop/interface/text-scaling-factor). Keys are organized hierarchically, similar to a file system path.
VALUE
The value to set for the specified key. This must be a string formatted according to the GVariant specification (e.g., 'true' for a boolean, 1.25 for a double, "'some string'" for a string, or "[1, 2, 3]" for an array). Note the nested quoting for strings within arrays.
--database=DATABASE
Specifies an alternative dconf database file to operate on instead of the default user or system databases.
--profile=PROFILE
Specifies an alternative dconf profile to load for the operation. Profiles define the database hierarchy used by dconf.
--sync
Immediately synchronizes pending changes to disk after the write operation. This ensures persistence and can be useful in scripts where immediate effect is desired, but might slightly impact performance.
--noprofile
Disables loading of the dconf profile for this operation, using only the default database paths.
--gsettings-backend=BACKEND
Specifies a particular GSettings backend to use for the operation (e.g., memory or dconf). This is typically for debugging or advanced use cases.
DESCRIPTION
The dconf-write command, typically invoked as a subcommand of the dconf utility (i.e., dconf write), is used to set a specific value for a given key within the dconf configuration system.
dconf is a low-level key-value database primarily used by desktop environments like GNOME to store application settings, user preferences, and system configurations. Unlike its predecessor GConf which used XML files, dconf uses a binary database for improved performance and simpler management.
This command provides a direct way to modify these settings programmatically. It requires a full path to the configuration key (e.g., /org/gnome/desktop/interface/text-scaling-factor) and the value to be set. The value must be provided in GVariant format, which supports various data types including strings, integers, booleans, arrays, and more. While powerful for scripting and automation, direct manipulation requires careful attention to key paths and value formats to avoid unintended side effects on applications or the desktop environment.
CAVEATS
Incorrect key paths or improperly formatted GVariant values can lead to unexpected behavior, data corruption, or instability in applications and the desktop environment. Users should exercise caution and ideally back up configurations or use dconf-editor or dconf read to inspect current values before making changes.
The command requires appropriate user permissions to write to the dconf database. Changes might not take effect immediately in running applications; a restart of the application or session might be necessary for them to apply.
COMMAND NAMING CONVENTION
While the prompt refers to dconf-write, the functionality is typically accessed via the dconf command's write subcommand (e.g., dconf write KEY VALUE). On many systems, dconf-write might exist as a symbolic link to the main dconf executable or is simply an informal way to refer to this specific operation, reflecting its historical usage or a common mental model of its function.
GVARIANT FORMAT SPECIFICS
Understanding GVariant serialization is crucial for using dconf write effectively. Common types include:
- Booleans: 'true' or 'false'
- Integers/Doubles: Raw numbers (e.g., 123, 3.14)
- Strings: Must be enclosed in single quotes, then the whole GVariant string typically in shell-level single or double quotes to prevent shell interpretation (e.g., "'Hello World'").
- Arrays: Represented as "[value1, value2, ...]", where each value adheres to GVariant syntax and is comma-separated.
- Tuples: Similar to arrays but defined with parentheses, "(value1, value2)".
HISTORY
The dconf system was introduced as the successor to GConf in GNOME 3, aiming for a more performant and simpler configuration management solution. dconf-write (or more commonly dconf write) emerged as the primary command-line interface for direct programmatic manipulation of these new binary-based configurations. Its development is tied closely to the evolution of the GNOME desktop environment and its underlying infrastructure, providing a robust backbone for desktop settings.
SEE ALSO
dconf(1), dconf-read(1), dconf-editor(1), gsettings(1)