353.1. xdg-desktop-portal-kde-6.8.2
KDE backend for xdg-desktop-portal — file chooser, screen cast, screenshots, settings and the rest under Plasma
| Version | 6.8.2, release 1 |
| Shelf | xdg — freedesktop desktop integration: portals, MIME, desktop entries, AppStream, tray and indicators, notifications, event sounds, script dialogs |
| Phase | 50_desktop (Desktop), 33 of 92 in build order |
| Licence | LGPL-2.0-or-later AND (LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL) AND LGPL-2.1-or-later AND GPL-2.0-or-later AND MIT AND BSD-2-Clause AND CC0-1.0 |
| Homepage | https://invent.kde.org/plasma/xdg-desktop-portal-kde |
| Build time | 0.3 SBU |
| Installed size | 4.0 MiB in 14 files |
| Recipe | ports/core/xdg/xdg-desktop-portal-kde/kpkgbuild |
About
xdg-desktop-portal-kde is the Plasma backend behind xdg-desktop-portal: the process that answers a boxed or sandboxed application’s portal requests with KDE’s own dialogs and services. It serves the file chooser, the application chooser, screen casting and remote desktop through KWin and kpipewire, screenshots through KWin’s ScreenShot2, print, e-mail, inhibit, background, global shortcuts, input capture, the clipboard, wallpaper, USB access and the Settings portal, which hands an application the colour scheme, accent and fonts of the Plasma session.
Why it is in KDOS
The comment above it in script/phases/50_desktop/packages.txt:
The portal backend under Plasma: file chooser, screen cast, screenshots, settings and the rest, drawn by KDE.
Sources
xdg-desktop-portal-kde-6.8.2.tar.xz(271.9 KiB)
sha256f67e2b7fee07a941b0de6294335d879a9bc0b5dc7dd3b48654dde373c67a9eb6
upstream: https://download.kde.org/stable/plasma/6.8.2/xdg-desktop-portal-kde-6.8.2.tar.xz
archive copy: sources-4/xdg--xdg-desktop-portal-kde-6.8.2.tar.xz
Dependencies
Depends on: cmake, ninja, extra-cmake-modules, pkgconf, qt6-qtbase, qt6-qtdeclarative, qt6-qtwayland, kcoreaddons, kconfig, ki18n, kglobalaccel, kio, kirigami, knotifications, kservice, kwidgetsaddons, kwindowsystem, kiconthemes, kstatusnotifieritem, kcrash, kwayland, wayland, wayland-protocols, plasma-wayland-protocols, libxkbcommon, kpipewire, pipewire, qt6-qt5compat, kdeclarative, kirigami-addons, kcmutils, kitemmodels, plasma-workspace, xdg-desktop-portal, kio-fuse.
Required by (1): kde-plasma.
Patches
build.sh applies these; kpkg applies nothing by itself.
hidden-entries.patch keeps applications whose desktop entry says NoDisplay=true out of the application chooser’s list of all applications and out of its search, and still shows one when it is a choice for the file, named by the request or associated with the file’s MIME type. Upstream lists every valid application service, so opening a video offers helpers such as kaccess, which appears as “Accessibility” with no icon, the Bluetooth wizard and settings pages. It is to be offered upstream to xdg-desktop-portal-kde.
hidden-entries.patch— Offer NoDisplay applications in the app chooser only as choicesThe chooser's full list holds every valid application service, NoDisplay ones included, so opening a video offers kaccess as "Accessibility" with a blank icon, the Bluetooth wizard, the Fcitx 5 helpers and settings pages. A NoDisplay entry stays in the model and is shown when it is a choice for the file, from the request or the MIME associations, and is left out of the list of all applications and its search.
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 xdg-desktop-portal-kde'
What kpkg does
kpkg runs these steps, in this order, as root inside the chroot. The port directory is /ports/core/xdg/xdg-desktop-portal-kde.
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/xdg/xdg-desktop-portal-kde
echo 'f67e2b7fee07a941b0de6294335d879a9bc0b5dc7dd3b48654dde373c67a9eb6 xdg-desktop-portal-kde-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/xdg-desktop-portal-kde
SRC=$SRC_ROOT/xdg-desktop-portal-kde-6.8.2
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
tar --no-same-permissions --warning=no-unknown-keyword -xf xdg-desktop-portal-kde-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/hidden-entries.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 \
-Wno-dev
cmake --build build
DESTDIR=$PKG cmake --install build
rm -rf "$PKG/usr/lib/systemd"
The switches, and why each is set:
-D KF_SKIP_PO_PROCESSING=ON— Skips building the interface translations, which the package-wide English-only rule would remove anyway (see Size and language policy).
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/xdg-desktop-portal-kde, 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 xdg-desktop-portal-kde-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/xdg-desktop-portal-kde, and runs the triggers its paths call for.
Contents
Installed directories: /usr/share/licenses/xdg-desktop-portal-kde.
Notes
The install puts a systemd user unit, plasma-xdg-desktop-portal-kde.service, under /usr/lib/systemd; build.sh removes the directory, since KDOS has no systemd (see No systemd). The backend is started by D-Bus activation and needs no unit: org.freedesktop.impl.portal.desktop.kde.service carries Exec=/usr/lib/libexec/xdg-desktop-portal-kde beside its SystemdService= line, and a bus daemon without systemd activation runs the Exec= command the first time the front end calls the name. Removing that line, or moving the binary without the service file, leaves every portal request with no backend.
The front end picks this backend from kde-portals.conf, which plasma-workspace installs, when XDG_CURRENT_DESKTOP is KDE; kde.portal lists the interfaces it serves and UseIn=KDE.
The dialogs are QML that import modules of other ports, which the build does not check for and which are in depends for run time: every dialog’s frame uses qt6-qt5compat’s Qt5Compat.GraphicalEffects; the screen-cast chooser lists windows through org.kde.taskmanager from plasma-workspace; the global-shortcuts dialog takes its key sequence editor from kdeclarative; and the dialogs use kirigami-addons, kcmutils and kitemmodels. A dialog whose import is missing does not open, and the request fails.
KWin hands its privileged interfaces only to a program whose desktop entry asks for them: the hidden org.freedesktop.impl.portal.desktop.kde.desktop names ScreenShot2 in X-KDE-DBUS-Restricted-Interfaces and the fake-input, window-management and screencast protocols in X-KDE-Wayland-Interfaces, and its Exec= is the binary’s path. A backend run from any other path gets no screenshots, no screen cast and no remote input.
FindKIOFuse.cmake asks the build machine’s session bus whether org.kde.KIOFuse can be activated and reports Could NOT find KIOFuse when it cannot, which is always the case in a build root; the result changes nothing in the build. The file chooser asks the same question at run time. When kio-fuse answers, the dialog offers every KIO location (sftp:, smb: and the rest) and hands the application a local path under the FUSE mount; when it does not, the dialog offers local files only. kio-fuse is in depends for that run-time use.