kwriteconfig5
Write configuration values to KDE configuration files
TLDR
Display help
Set a global configuration key
Set a key in a specific configuration file
Delete a key
Use systemd to start the Plasma session when available
Hide the title bar when a window is maximized (like Ubuntu)
Configure KRunner to open with the Meta (Command/Windows) global hotkey
SYNOPSIS
kwriteconfig5 [options]
kwriteconfig5 [--file file | --application application] --group group --key key --value value [--type type]
kwriteconfig5 [--file file | --application application] --group group --key key --delete
kwriteconfig5 [--file file | --application application] --group group --deletegroup
PARAMETERS
--file file
Specifies the path to the configuration file to be modified (e.g., ~/.config/kdeglobals).
--application application
Specifies the application name. kwriteconfig5 will infer the standard configuration file path for this application (e.g., kdeglobals for global settings, plasmarc for Plasma settings).
--group group
Defines the configuration group (section) within the file where the key resides or will be created (e.g., General, KDE).
--key key
Identifies the specific key (setting) within the group to be written or deleted (e.g., ColorScheme, MenuEffect).
--value value
The value to be written to the specified key. This option is required when writing a key.
--type type
Specifies the data type of the --value. Supported types include String (default), QStringList, Int, UInt, Bool, Double, QColor. Using the correct type is crucial for proper interpretation by KDE applications.
--delete
Deletes the specified key within its group. Requires --group and --key.
--deletegroup
Deletes the entire specified group, including all its keys. Requires --group.
--help
Displays a brief help message and exits.
--version
Shows version information and exits.
DESCRIPTION
The kwriteconfig5 command is a command-line utility provided by KDE Frameworks for programmatically modifying KDE configuration files. These files, typically located in ~/.config/, store various settings for the KDE Plasma desktop and its applications. It allows users and scripts to easily write, update, or delete specific configuration keys within designated groups. This tool is essential for automating KDE setup, deploying consistent configurations across multiple systems, or for users who prefer scripting over graphical interface for setting changes. It interacts with the KConfig system, ensuring changes are applied correctly according to the KDE configuration standard. While kreadconfig5 is used for reading settings, kwriteconfig5 provides the complementary functionality for modifying them.
CAVEATS
Changes made by kwriteconfig5 might not take effect immediately. Many KDE applications read their configuration only at startup. To apply changes, you often need to restart the affected application or even log out and back into the KDE Plasma session.
Improper use, such as incorrect data types or deleting critical settings, can lead to unexpected behavior or breakage in KDE applications or the desktop environment itself. Always back up critical configuration files before making extensive changes. The command requires write permissions to the target configuration file.
USAGE EXAMPLES
Here are some common usage examples:
1. Set the global color scheme to 'Breeze Dark':
kwriteconfig5 --file kdeglobals --group General --key ColorScheme --value "Breeze Dark"
2. Enable a specific menu effect (e.g., 'Fade') for KMenu:
kwriteconfig5 --file kdeglobals --group KMenu --key MenuEffect --value Fade
3. Change the font size for a specific application (e.g., Konsole, using --application):
kwriteconfig5 --application konsole --group 'Konsole Window' --key Font "Monospace,10,-1,5,50,0,0,0,0,0" --type String
Note: The font string format might vary.
4. Delete a specific key (e.g., a custom shortcut):
kwriteconfig5 --file kglobalshortcutsrc --group org.kde.konsole.desktop --key 'New Window' --delete
5. Delete an entire group:
kwriteconfig5 --application kwinrc --group Compositing --deletegroup
CONFIGURATION FILE PATHS
When using --application, kwriteconfig5 infers the configuration file path. For example, --application kdeglobals typically targets ~/.config/kdeglobals, --application plasmarc targets ~/.config/plasmarc, and application-specific settings like --application konsole target ~/.config/konsolerc. The exact location can be influenced by XDG_CONFIG_HOME environment variable.
DATA TYPES
kwriteconfig5 supports various data types via the --type option. If omitted, it defaults to String. Using the correct type ensures that applications interpret the value as expected. For instance, a boolean value 'true' or 'false' should ideally be set with --type Bool, and numeric values with --type Int or --type Double. QStringList can be used for values that are lists of strings, often comma-separated or newline-separated depending on the context.
HISTORY
The kwriteconfig5 command is part of the KDE Frameworks 5, specifically the KConfig module. It is the successor to kwriteconfig from KDE Platform 4. The evolution from KDE4 to KDE5 (Plasma 5) involved significant refactoring of core libraries and tools, including the KConfig system. kwriteconfig5 maintains similar functionality to its predecessor but is built against Qt5 and KDE Frameworks 5, ensuring compatibility with the modern KDE Plasma desktop environment. Its primary role has consistently been to provide a robust command-line interface for managing KDE's INI-style configuration files.
SEE ALSO
kreadconfig5(1), qdbus(1), kdialog(1)