Skip to the text
KDOS
Menu
kdos.dev KDOS from Scratch KDOS 0.2 · 4dd4a10 · 2026-11-30 Contents Index

354.6. kwin-6.8.2

KDE Plasma's Wayland compositor and window manager, with Xwayland for X11 clients

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), 6 of 92 in build order
Licence GPL-2.0-or-later AND (LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL) AND (GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL) AND GPL-3.0-or-later AND BSD-3-Clause AND BSD-2-Clause AND CC0-1.0 AND LGPL-2.0-or-later AND LGPL-2.0-only AND LGPL-2.1-or-later AND MIT
Homepage https://invent.kde.org/plasma/kwin
Build time 17.2 SBU
Installed size 32.9 MiB in 593 files
Recipe ports/core/kde/kwin/kpkgbuild

About

KWin is the Plasma desktop’s compositor and window manager. On KDOS it runs only as kwin_wayland: the Wayland compositor that takes the DRM device and the input devices, places, decorates and draws every window, runs the effects (Overview, the window switcher, Night Light, zoom, the screen edges), serves global shortcuts through kglobalacceld, shows the lock screen of kscreenlocker, and starts xwayland the first time an X11 client connects. startplasma-wayland runs it under kwin_wayland_wrapper, which holds the Wayland socket and starts KWin again after any exit but a clean one, up to ten crashes in a row, so clients reconnect to the new compositor; the SDDM greeter runs a second copy of it for the login screen. Its settings pages (window rules, decorations, effects, virtual desktops, the task switcher, screen edges, Xwayland) are KCMs that System Settings loads.

KWin implements wp_security_context_v1. A client that connects through a socket tagged with it counts as sandboxed. Upstream refuses it seven globals: window management (org_kde_plasma_window_management), fake input, screencasting, activation feedback, the lock-screen overlay, data control, and the security-context manager itself; KDOS’s sandbox-policy.patch refuses it the desktop-shell globals as well, unless the box’s profile grants them back. Its windows carry the tag’s app id in place of their own, and their title bar shows a box before the caption.

The port also builds kdos_crt, the effect behind Phosphor mode, into KWin.

Why it is in KDOS

The comment above it in script/phases/50_desktop/packages.txt:

The compositor and window manager, with Xwayland for X11 clients.

Sources

Dependencies

Depends on: cmake, ninja, pkgconf, extra-cmake-modules, python3, qt6-qtbase, qt6-qtdeclarative, qt6-qtwayland, qt6-qtsvg, qt6-qt5compat, qt6-qttools, kauth, kcolorscheme, kconfig, kcoreaddons, kcrash, kdbusaddons, kglobalaccel, kguiaddons, ki18n, kidletime, kpackage, kservice, ksvg, kwidgetsaddons, kwindowsystem, kdeclarative, kcmutils, knewstuff, kxmlgui, krunner, knotifications, kdoctools, kirigami, kitemmodels, kquickcharts, knighttime, kwayland, kdecoration, plasma-activities, kglobalacceld, kscreenlocker, libplasma, breeze, aurorae, milou, plasma-wayland-protocols, wayland, wayland-protocols, mesa, libglvnd, libepoxy, vulkan-headers, vulkan-loader, libdrm, libinput, libxkbcommon, eudev, lcms2, libdisplay-info, libxcvt, libcanberra, pipewire, libei, libevdev, libcap, libqaccessibilityclient, hwdata, libxcb, xcb-util-cursor, xcb-util-keysyms, xcb-util-wm, libX11, libXi, xwayland.

Required by (10): kde-plasma, kdeplasma-addons, kdos-kwin-motion, krohnkite, kwin-effect-kdos-keys, kwin-script-kdos-runraise, kwin-script-kdos-window-memory, plasma-desktop, plasma-workspace, sddm.

Patches

build.sh applies these; kpkg applies nothing by itself.

sandbox-policy.patch is KDOS’s boundary for boxed applications at the compositor. Upstream refuses a client of a wp_security_context_v1 socket seven globals and offers it every other one; the patch also refuses the layer shell, output management and external brightness, DRM leases, DPMS, the Plasma shell surface, screen edges, the keyboard state and virtual-desktop management, and lets a box open named sets of them again through the grant key of its profile, ~/.config/kdos/boxes/<box>.conf: window-list, fake-input, screencast, data-control, layer-shell, output-management, dpms and plasma-shell (input-method is accepted and opens nothing, because KWin keeps the input-method globals for the input method it starts). The box is the context’s instance id, which kdos-boxsock sets. A profile is read only for the engine io.kdos.appbox or an engine beginning io.kdos.appbox+, and only once per client. wp_security_context_manager_v1 and kde_lockscreen_overlay_v1 are never granted. The path is $HOME/.config, not $XDG_CONFIG_HOME, because kdos-appbox writes it there and the two must never disagree. It keeps the context’s sandbox engine and instance id on the client connection, which a grant source needs and which upstream drops; that half is to be proposed upstream, the KDOS profile reader is not.

sandbox-badge.patch gives a window three constant properties, sandboxEngine, sandboxAppId and sandboxInstanceId, read from its client’s security context, and passes them to the decoration through KDecoration3’s DecoratedWindowPrivateV5, so Breeze can draw a box glyph before a confined window’s caption. An X11 window reads as unsandboxed: its surface is Xwayland’s. A KDOS box’s engine carries which boundary held, io.kdos.appbox+private or io.kdos.appbox+tagged, which is how the glyph tells a confined box from one that could reach past its tag. It is applied after sandbox-policy.patch, whose engine and instance id it reads, and needs the kdecoration and breeze patches of the same name: against an unpatched kdecoration KWin does not compile. It is to be proposed upstream with them (it serves Flatpak’s org.flatpak engine unchanged).

kdos-crt.patch adds kdos_crt, the effect behind Phosphor mode, as a built-in effect: it is compiled into KWin instead of shipped as a plugin, because the loader refuses an out-of-tree effect built against any other KWin release, point releases included, and a built-in one is a static plugin it never checks. It paints each output into an offscreen texture and draws it back through a CRT shader: a three-tap horizontal bleed, scanlines on every third row, a vignette, barrel curvature, a faint floor in the accent, a 400 ms degauss when the colour scheme’s accent changes, and a collapse to a line and a dot when the session locks or quits. It is off by default, refuses a software renderer and HDR outputs, gives screenshots, screencasts and the colour picker the plain picture, stands aside while zoom or the magnifier runs, and with Fullscreen=false gives an active fullscreen window’s output back to direct scanout. It is KDOS’s own and not upstream; KDOS is to propose instead a generic “custom screen shader” effect that loads a GLSL file and its uniforms, after which this shader ships as data and the patch is dropped. The effect interface moves between Plasma minor releases, so the patch is rebased at each one. It shares no file with the two sandbox patches.

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 kwin'

What kpkg does

kpkg runs these steps, in this order, as root inside the chroot. The port directory is /ports/core/kde/kwin.

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/kwin
echo 'ea5e68d957c7d70abed97222a592d4445fda29129e20942658badd224ee138b4  kwin-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/kwin
SRC=$SRC_ROOT/kwin-6.8.2
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
tar --no-same-permissions --warning=no-unknown-keyword -xf kwin-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/sandbox-policy.patch"
patch -p1 -i "$PORT_SRC/sandbox-badge.patch"
patch -p1 -i "$PORT_SRC/kdos-crt.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 KWIN_BUILD_X11=ON \
	-D CMAKE_REQUIRE_FIND_PACKAGE_X11_XCB=ON \
	-D CMAKE_REQUIRE_FIND_PACKAGE_PlasmaActivities=ON \
	-D CMAKE_REQUIRE_FIND_PACKAGE_Libeis-1.0=ON \
	-D CMAKE_REQUIRE_FIND_PACKAGE_QAccessibilityClient6=ON \
	-D CMAKE_REQUIRE_FIND_PACKAGE_KF6DocTools=ON \
	-D CMAKE_REQUIRE_FIND_PACKAGE_Python3=ON \
	-Wno-dev
for m in PipeWire libevdev; do
	grep -q "^${m}_FOUND:INTERNAL=1" build/CMakeCache.txt || {
		echo "kwin: pkg-config found no $m" >&2
		exit 1
	}
done
cmake --build build
DESTDIR=$PKG cmake --install build
rm -rf "$PKG/usr/lib/systemd"

The switches, and why each is set:

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/kwin, 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 kwin-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/kwin, and runs the triggers its paths call for.

Contents

Installed programs: kwin_wayland, kwin_wayland_wrapper, kwindowprop.

Installed libraries: libkcmkwincommon.so, libkwin.so.

Installed directories: /usr/include/kwin, /usr/lib/cmake/KWin, /usr/lib/cmake/KWinDBusInterface, /usr/lib/qt6/plugins/kwin/plugins, /usr/lib/qt6/qml/org/kde/kwin/private, /usr/share/doc/HTML/en/kcontrol/desktop, /usr/share/doc/HTML/en/kcontrol/kwindecoration, /usr/share/doc/HTML/en/kcontrol/kwineffects, /usr/share/doc/HTML/en/kcontrol/kwinscreenedges, /usr/share/doc/HTML/en/kcontrol/kwintabbox, /usr/share/doc/HTML/en/kcontrol/kwintouchscreen, /usr/share/doc/HTML/en/kcontrol/kwinvirtualkeyboard, /usr/share/doc/HTML/en/kcontrol/windowbehaviour, /usr/share/doc/HTML/en/kcontrol/windowspecific, /usr/share/kwin/builtin-effects, /usr/share/kwin/effects/dialogparent, /usr/share/kwin/effects/dimscreen, /usr/share/kwin/effects/eyeonscreen, /usr/share/kwin/effects/fade, /usr/share/kwin/effects/fadedesktop, /usr/share/kwin/effects/fadingpopups, /usr/share/kwin/effects/frozenapp, /usr/share/kwin/effects/fullscreen, /usr/share/kwin/effects/login, /usr/share/kwin/effects/logout, /usr/share/kwin/effects/maximize, /usr/share/kwin/effects/scale, /usr/share/kwin/effects/sessionquit, /usr/share/kwin/effects/squash, /usr/share/kwin/effects/translucency, /usr/share/kwin/effects/windowaperture, /usr/share/kwin/frames, /usr/share/kwin/onscreennotification, /usr/share/kwin/outline, /usr/share/kwin/scripts/desktopchangeosd, /usr/share/kwin/scripts/minimizeall, /usr/share/kwin/scripts/synchronizeskipswitcher, /usr/share/kwin/scripts/videowall, /usr/share/kwin/tabbox/thumbnail_grid, /usr/share/licenses/kwin.

Notes

The effect’s settings are kwinrc [Effect-kdos_crt]: Strength (0–100, 55), Scanlines (0–100, 0), Curve (0–100, 0) and Fullscreen (false). kdos phosphor turns it on with [Plugins] kdos_crtEnabled=true and org.kde.KWin /Effects loadEffect kdos_crt. While it runs the scene is composited on every frame of every output it draws on, the hardware cursor plane and direct scanout are given up and the pointer is drawn into the picture, so it curves with it. The power-down is also exported as io.kdos.Crt1 (Collapse, Unfold, Degauss, property Phase) at /io/kdos/Crt1 on org.kde.KWin, and qdbus6 org.kde.KWin /Effects debug kdos_crt prints its state and each output’s verdict. KWIN_KDOS_CRT_DUMP=<prefix> in KWin’s environment writes the pass’s input and output once as <prefix>-in.png and <prefix>-out.png (KWIN_KDOS_CRT_DUMP_FRAME=<n> waits for the n-th passed frame); it is read only from KWin’s own environment, so no client can use it to capture the screen. KWIN_EFFECTS_FORCE_ANIMATIONS=1 lets it load on a software renderer, for a test only. The settings page, kwin_kdos_crt_config, is built because KWIN_BUILD_KCMS is on, upstream’s default.

Two features hang on a pkg_check_modules probe, which no CMake switch can make required: screencasting (the screencast plugin that streams outputs and windows to the portal over pipewire) and game controllers (the gamecontroller plugin, off until it is enabled in the settings, which reads controllers through libevdev, counts their use as user activity so the screen does not idle, and can drive the pointer and keys with one). After the configure, build.sh reads PipeWire_FOUND and libevdev_FOUND from CMakeCache.txt and stops the build if either probe failed.

A third probe, for a libsystemd.pc, has no switch either. When one is found, KWin links it for a watchdog that answers only a systemd service manager (WATCHDOG_USEC) and for a check that counts a process in a Flatpak or Snap unit under app.slice as sandboxed. elogind installs its library under its own name, libelogind.pc, so on KDOS both are compiled out, the package links no session library, and only the security-context tag marks a client as sandboxed. An elogind that also installs libsystemd.pc makes KWin link libelogind, and elogind then belongs in depends. The tag filters only what reaches the tagged socket: a box’s boundary is its private runtime directory, which holds no wayland-0, and its filtered bus. A box granted fake-input or window-list can act on the whole desktop.

The X11 windowed backend reads pointer motion through the X Input extension when CMake’s FindX11 finds libXi at configure time, and polls the pointer otherwise. The build reads only the headers from it, so it is in depends for the build alone.

The install runs setcap CAP_SYS_NICE=+ep on /usr/bin/kwin_wayland, and find_package(Libcap) is required for that, so libcap, which provides setcap, is in depends. kpkg’s package tar records no file capabilities, so the installed binary has none. KWin asks for SCHED_RR at the lowest real-time priority for its main thread, the DRM commit thread and the input thread, which needs either the capability or an RLIMIT_RTPRIO of at least 1 for the user. With no capability, that limit is the one pam_limits sets at login from /etc/security/limits.d; without it KWin logs Failed to gain real time thread priority and composites at normal priority.

The install puts a systemd user unit, plasma-kwin_wayland.service, under /usr/lib/systemd; build.sh removes the directory, since KDOS has no systemd (see No systemd). KF_SKIP_PO_PROCESSING stops only ki18n_install(): kdoctools_install() still builds the handbook in every translated language, and kpkg’s language rule removes /usr/share/doc/HTML/<lang>/ from the package.

CMake records several packages as run-time only and builds the same without them; each is in depends because the session needs it. KWin loads the configured decoration, then org.kde.breeze from breeze when that fails, then org.kde.kwin.aurorae from aurorae, so a window keeps a frame while any of the three loads. xwayland is found on PATH when an X11 client connects, and hwdata’s pnp.ids names a monitor’s manufacturer. The QML of the effects and pages imports kirigami, libplasma and ksvg, Qt5Compat.GraphicalEffects from qt6-qt5compat in Overview, the window heap and the tile editor, org.kde.milou from milou for Overview’s search, org.kde.kitemmodels from kitemmodels in the tile editor and the window rules page, and org.kde.quickcharts from kquickcharts in the Show FPS effect.

When Xwayland starts, KWin starts every file in /etc/xdg/Xwayland-session.d with DISPLAY set to it, in name order and without waiting for one before the next, and then plasma-workspace’s /usr/lib/libexec/plasma-setup-xwayland; it takes the X11 window-manager selections only once all of them have finished or failed to start.

The decoration, effects and scripts pages carry “Get New…” buttons from knewstuff, which is required whenever the settings pages are built. The ghns Kiosk restriction in the session’s kdeglobals disables them, since nothing is downloaded at run time.

None of the patches is for musl: nothing in this release needs one. SCHED_RESET_ON_FORK, which the real-time request is compiled behind, is defined in musl’s <sched.h> without _GNU_SOURCE; memfd_create, which KWin’s shared-memory buffers use, is in musl; and the mallopt(M_TRIM_THRESHOLD) tuning is compiled only where the C library defines M_TRIM_THRESHOLD, which musl does not.