354.20. kde-gtk-config-6.8.2
Plasma's settings bridge to GTK — theme, fonts, icons, cursor and window buttons for GTK 3 and 4 applications
| Version | 6.8.2, release 1 |
| Shelf | kde — KDE Plasma and Gear platform pieces outside Frameworks that have no other domain: KIO workers, thumbnailers, Plasma integration, KDE Wayland glue |
| Phase | 50_desktop (Desktop), 43 of 92 in build order |
| Licence | (GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL) AND GPL-2.0-or-later |
| Homepage | https://invent.kde.org/plasma/kde-gtk-config |
| Build time | 1.4 SBU |
| Installed size | 553.0 KiB in 18 files |
| Recipe | ports/core/kde/kde-gtk-config/kpkgbuild |
About
kde-gtk-config makes GTK applications follow Plasma’s settings. Its kded module, gtkconfig, watches the Plasma configuration and writes the theme, icon theme, cursor, fonts, colour scheme and window-button layout to every place a GTK program reads them: settings.ini for GTK 3 and 4, GSettings, and the XSETTINGS that xsettingsd serves to GTK programs under Xwayland. It also renders CSS that gives breeze-gtk’s client-side window decorations Plasma’s button set and colours.
Why it is in KDOS
The comment above it in script/phases/50_desktop/packages.txt:
Carries the Plasma theme, fonts, icons and cursor to GTK 3 and 4 applications.
Sources
kde-gtk-config-6.8.2.tar.xz(77.5 KiB)
sha256883a7c5f2491c180d0ce2631217d20ca450fe6ad1587a2cfa271a51a100cd638
upstream: https://download.kde.org/stable/plasma/6.8.2/kde-gtk-config-6.8.2.tar.xz
archive copy: sources-3/kde--kde-gtk-config-6.8.2.tar.xz
Dependencies
Depends on: cmake, ninja, extra-cmake-modules, pkgconf, qt6-qtbase, qt6-qtsvg, kcolorscheme, kcoreaddons, kconfig, kguiaddons, kdbusaddons, kwindowsystem, kdecoration, glib, gtk3, gsettings-desktop-schemas, sassc, xsettingsd, dconf, breeze-gtk.
Required by (1): kde-plasma.
Patches
build.sh applies these; kpkg applies nothing by itself.
Each patch is to be offered upstream; the merge requests are to be opened against plasma/kde-gtk-config, and each entry names its own once it exists.
libadwaita-colors.patch — libadwaita draws only from its own named colours and, from 1.6, from CSS variables, never from the GTK theme, so the Breeze colour names alone leave a libadwaita program in Adwaita’s palette under every KDE scheme. The patch writes the accent, status, window, view, header bar, sidebar, card, dialog, popover and thumbnail colours from the same KColorScheme sets into the colors.css the kded module already maintains: as @define-color names for GTK 3 and 4, and for GTK 4 also as the :root custom properties libadwaita 1.10 reads. GTK 3 cannot parse custom properties, so only gtk-4.0/colors.css carries them. KDOS writes nothing under ~/.config/gtk-*: this module is the one writer.
gsd-xsettings-with-portal.patch — The module serves org.gtk.Settings on every Wayland session; upstream skips it when GTK_USE_PORTAL is 1, which every KDOS login exports (/etc/profile.d/10-wayland.sh) and kded inherits. GTK 3 on Wayland reads gtk-modules only from that service’s Modules property and ignores the line in settings.ini, so without it colorreload-gtk-module never loads and a running GTK 3 program keeps its colours through every colour-scheme change. The variable is about the GTK programs’ dialogs, not about kded. The same variable sends GTK 3 to the Settings portal for its other settings, and an unpatched GTK 3 then never opens this service; gtk3 carries the patch that opens it beside the portal, and the two patches are needed together.
first-login-config.patch — At a new user’s first login ~/.config/gtk-4.0 does not exist when the module writes gtk.css and colors.css, and Qt’s file open does not make a missing directory, so a GTK 4 or libadwaita program wears stock Adwaita until the next colour change; the patch creates each GTK config directory before writing into it. At the same login kconf_update’s gtk_theme step writes gtk-theme-name=Breeze into gtk-3.0/settings.ini while kded is already running and after the module has read that file, so unpatched the module takes the theme for unset and removes Breeze’s window_decorations.css and button assets; the patch takes the name from GSettings, which holds the same value, whenever settings.ini names none. It is applied after libadwaita-colors.patch, whose modifyColorsCssFile it touches.
first-login-config.patch— Write the GTK 4 colours and Breeze decorations from the first loginAt the first login of a new user ~/.config/gtk-4.0 does not exist when the module writes gtk.css and colors.css, and QFile does not create a missing directory, so a GTK 4 or libadwaita program wears stock Adwaita until the next colour change. Create each GTK config directory before writing into it.
At the same login kconf_update writes gtk-theme-name=Breeze into settings.ini while kded is already running, after the module has read the file, so the module takes the theme for unset, removes Breeze's window_decorations.css and writes no decoration assets. When settings.ini names no theme, take the name from GSettings, which holds the same one.
gsd-xsettings-with-portal.patch— Serve org.gtk.Settings whatever GTK_USE_PORTAL saysGTK_USE_PORTAL=1 tells GTK 3 programs to use the portal file chooser and print dialog; it says nothing about kded. GTK 3 on Wayland takes gtk-modules only from the Modules property of org.gtk.Settings, so a session that exports the variable gets no org.gtk.Settings, never loads colorreload-gtk-module, and a running GTK 3 program does not repaint when the colour scheme changes. Create the settings manager on every Wayland session.
libadwaita-colors.patch— Write libadwaita's colours from the KDE scheme into colors.csslibadwaita ignores the GTK theme and draws only from its own named colours, so with the Breeze names alone a libadwaita program keeps Adwaita's palette under every KDE colour scheme and follows only the accent and the light/dark preference the settings portal carries. The kded module now also writes accent, status, window, view, header bar, sidebar, card, dialog, popover and thumbnail colours from the same KColorScheme sets it already reads: as named colours for both GTK versions, and for GTK 4 as the CSS custom properties (--accent-bg-color and the rest) that libadwaita 1.6 and later reads instead. GTK 3 cannot parse custom properties, so its colors.css gets the names only. A status colour that fills a button takes the view's background or its text on top, whichever has the higher contrast ratio against it.
Installation
From the repository root, inside the build container, this is the line kdosbuild runs for the port:
script/chroot/exec.sh bash -c 'source script/phases/50_desktop/phase.env && kpkg install kde-gtk-config'
What kpkg does
kpkg runs these steps, in this order, as root inside the chroot. The port directory is /ports/core/kde/kde-gtk-config.
1. Verify every declared source. Each file a sha256 = line names, found in the port directory or in /var/cache/kpkg/sources, must hash to its line; a mismatch stops the build before anything is unpacked.
cd /ports/core/kde/kde-gtk-config
echo '883a7c5f2491c180d0ce2631217d20ca450fe6ad1587a2cfa271a51a100cd638 kde-gtk-config-6.8.2.tar.xz' | sha256sum -c -
2. Unpack. The work directory is emptied and the first source is unpacked into $SRC with its top directory stripped; any later tarball lands unstripped beside it in $SRC_ROOT, and a file that is not a tarball is copied into $SRC.
SRC_ROOT=/var/cache/kpkg/work/kde-gtk-config
SRC=$SRC_ROOT/kde-gtk-config-6.8.2
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
tar --no-same-permissions --warning=no-unknown-keyword -xf kde-gtk-config-6.8.2.tar.xz -C "$SRC" --strip-components=1
Every config.guess and config.sub older than automake’s is then replaced with automake’s, so a configure script recognises the musl target.
3. Build. build.sh is sourced in a subshell under set -e, from $SRC, with name, version, release and the recipe’s helpers group and the five paths PKGNAME, PORT_SRC, SRC_ROOT, SRC and PKG set as shell variables. Its body, verbatim:
patch -p1 -i "$PORT_SRC/libadwaita-colors.patch"
patch -p1 -i "$PORT_SRC/gsd-xsettings-with-portal.patch"
patch -p1 -i "$PORT_SRC/first-login-config.patch"
cmake -S . -B build -G Ninja \
-D CMAKE_INSTALL_PREFIX=/usr \
-D KDE_INSTALL_LIBDIR=lib \
-D CMAKE_BUILD_TYPE=Release \
-D KDE_INSTALL_USE_QT_SYS_PATHS=ON \
-D BUILD_TESTING=OFF \
-D KF_SKIP_PO_PROCESSING=ON \
-D CMAKE_REQUIRE_FIND_PACKAGE_XSettingsd=ON \
-Wno-dev
cmake --build build
DESTDIR=$PKG cmake --install build
The switches, and why each is set:
-D KF_SKIP_PO_PROCESSING=ON— The project ships no interface translations, so this changes nothing today; every KDE recipe passes it, so a catalogue added upstream is skipped as well (see Size and language policy).-D CMAKE_REQUIRE_FIND_PACKAGE_XSettingsd=ON— Makexsettingsda requirement of the configure. Upstream looks for the program only to report it; the module starts it, or sends itSIGHUP, whenever a setting changes, and without it a GTK program under Xwayland keeps the settings it started with.
The common switches of each build system are explained in the Flag glossary.
4. Package. kpkg removes libtool archives, the info directory index, mimeinfo.cache and every fonts.dir from $PKG, copies the source’s licence files into /usr/share/licenses/kde-gtk-config, prunes what the image does not ship, lints the tree and rolls it reproducibly:
tar --sort=name --format=gnu --numeric-owner --owner=0 --group=0 \
--mtime=@$SOURCE_DATE_EPOCH \
--use-compress-program='xz -9 -T0 --block-size=32MiB --no-adjust' \
-cf kde-gtk-config-6.8.2-1.tar.xz -C "$PKG" .
5. Adopt. kpkgadd installs the package’s files over the root, refusing a path another package owns, records the file list in /var/lib/kpkg/db/kde-gtk-config, and runs the triggers its paths call for.
Contents
Installed directories: /usr/share/kcm-gtk-module, /usr/share/licenses/kde-gtk-config.
Notes
sassc runs at build time: kded/scss/build_decorations_css.sh compiles window_decorations.scss into the CSS installed as /usr/share/themes/Breeze/window_decorations.css, beside breeze-gtk’s theme. The configure stops without it.
GSettings keeps what the module writes only through dconf, GIO’s persistent backend; without it the values are held in memory by the writing process and no GTK 4 program sees them. dconf and breeze-gtk, the theme the module selects by default, are in depends for run time. gsettings-desktop-schemas is checked at build time and read at run time: a key whose schema is missing is skipped.
The module is loaded by kded when the session starts and is the one writer of GTK settings; a GTK setting changed by another tool is overwritten at the next Plasma change.