kreadconfig5
Read configuration settings from KDE configuration files
TLDR
Read a key from the global configuration
Read a key from a specific configuration file
Check if systemd is used to start the Plasma session
SYNOPSIS
kreadconfig5 [--file <filename>] [--group <groupname>] [--key <keyname>] [--default <defaultvalue>] [--global]
PARAMETERS
--file <filename>, -f <filename>
Specifies the exact config file to read (e.g., kwinrc). Defaults to app-specific search paths.
--group <groupname>, -g <groupname>
The config section (INI group) containing the key. Required for targeted reads.
--key <keyname>, -k <keyname>
The setting name to retrieve. Required.
--default <defaultvalue>, -d <defaultvalue>
Value to output if key not found. Quoted if containing spaces.
--global
Read from system-wide configs only, ignoring user overrides.
DESCRIPTION
The kreadconfig5 command is a utility from the KDE Frameworks 5 suite, designed to retrieve specific values from KDE configuration files. These files, typically with a .rc extension, store settings in an INI-like format and are located in standard directories such as ~/.config/ for user-specific configs or system-wide paths like /etc/xdg/ when using the --global option.
It allows scripts and applications to query configuration keys without parsing files manually, leveraging the KConfig library backend. Specify a --group (equivalent to an INI section) and --key to fetch the value, with an optional --default fallback if the key is absent. Output is printed to stdout as a plain string.
This tool is essential for Plasma 5 desktop automation, panel scripting, and dynamic configuration reading in shell scripts. It respects KDE's config merging: user overrides system settings unless --global is used.
CAVEATS
Fails silently if group/key missing without --default; use quotes for defaults with spaces. Not for writing configs (use kwriteconfig5). Deprecated in Plasma 6 (use kreadconfig6).
EXAMPLES
kreadconfig5 --file plasmarc --group Wallpaper --key lastWallpaper (prints last wallpaper path).
kreadconfig5 --global --file kwinrc --group org.kde.kdecoration2 --key BorderSize --default 1 (system border size with fallback).
HISTORY
Introduced in KDE Frameworks 5 (2014) for Plasma 5. Successor to kreadconfig4; evolved from Qt/KDE config tools since early 2000s.
SEE ALSO
kwriteconfig5(1), KConfig(7)


