Part XIII. The desktop
This part is for anyone building KDOS who wants to know what the graphical desktop is made of and in what order it is built. Its phase, 50_desktop, installs the ports of the desktop: the display manager SDDM (the login screen), the compositor KWin, the Plasma shell and its daemons, System Settings, the portal backend, the input method with its language engines, Discover, KDOS’s own Plasma code from src/desktop, KDOS’s daemons from src/daemons, and the meta ports that name the KDE install set.
The sections below explain why the desktop is a phase of its own and why those two src/ directories are searched here and nowhere else, then walk through the phase in the order it builds, with a link to each port’s page and to the chapter of The KDOS book that describes how the program behaves. The package pages follow, in chapters by shelf, in the shelves’ own order, and within a shelf in the order kpkgdepends builds them.
Why the desktop is a phase of its own
The list’s header says what the phase is for and what it leaves to the phases before it:
# Everything the desktop session is, and nothing an application needs at build
# time: KWin, the Plasma shell and its daemons, SDDM, the portals, the input
# method, KDOS's own Plasma code and daemons, and the meta ports. The Plasma
# libraries that Gear applications link (libplasma, kpipewire,
# plasma-activities, union and the rest) are 43_toolkits. A port listed here is
# never named in the `depends` of a 41-44 port.
script/phases/50_desktop/packages.txt, lines 13–18
The Qt and KDE Frameworks libraries, and the Plasma libraries that applications link, therefore have their pages in Part XI, and Wayland’s own libraries in Part IX and Part X. What is left for this phase is what only the session needs, and the phase table in Which phase lists a port gives exactly that as its rule. fcitx5’s dependencies are all installed by the end of Part XI, so by closure alone it could be built there; it is listed here because it is the program on the other end of KWin’s input-method protocol, and the list’s comment above it says so.
The programs from src/ have a stronger reason. The phase’s phase.env is the only one whose PORT_REPO names src/desktop and src/daemons:
# src/desktop and src/daemons join the port repos here and nowhere earlier:
# KDOS's KCMs, plasmoids, KWin plugins, Discover backends and installer link
# libplasma, KWin and libdiscover, which this phase installs, and the daemons
# serve that session.
export PORT_REPO="/ports/core /kdos/src/system /kdos/src/art /kdos/src/desktop /kdos/src/daemons"
script/phases/50_desktop/phase.env, lines 25–29
kpkg looks for a port only in the repositories PORT_REPO names (see Where kpkg looks for a port), so no earlier phase can build these programs, and testing/phaseclosure.py refuses a port in an earlier phase that depends on one of them, since that dependency could only be resolved by a later phase’s PORT_REPO. KDOS’s settings pages, widgets, KWin plugins and Discover backend link libplasma, KWin and libdiscover, which this phase installs, and the daemons are built beside them.
The split also gives the build a restore point. The snapshot taken at the end of 44_apps holds the whole userland and none of the desktop, so resuming from it re-runs only this phase, the kernel and the image (see The desktop: 50_desktop).
The list and its chapters
The list is one file, script/phases/50_desktop/packages.txt. A heading of the form # <shelf> — <description> opens each shelf’s ports: auth, sysmon, hardware, input, disk, filesystem, security, transfer, graphics, xdg, kde and printing for the upstream ports, then src-art, src-desktop and src-daemons for KDOS’s own, and meta last for the ports that only name others. No name comes before the first heading, so the list has no pinned run (see Package lists), and under kdosbuild --port-jobs no serial prefix (see Building a package phase by level). The chapters below follow the ports’ own shelves, with the src- chapters after the upstream ones; a meta port sits on the kde shelf.
A tour of the build
kpkgdepends builds the phase in the order the list gives, each port after what it depends on. Read in that order, the phase falls into six groups.
The login screen
sddm is the display manager. It is built for Qt 6 with elogind and no systemd, and installs three PAM stacks of KDOS’s own, sddm, sddm-autologin and sddm-greeter, in place of upstream’s; the page explains each line. kwallet-pam opens the user’s wallet with the password typed at the greeter. The greeter’s theme, kdos-sddm-theme, is in the src-art group below. How SDDM is started and when it gives way to a text prompt is in Login and autologin.
The input method
fcitx5 comes with its engines: libime and fcitx5-chinese-addons for Chinese, anthy-unicode and fcitx5-anthy for Japanese, and libhangul and fcitx5-hangul for Korean, then fcitx5-qt, fcitx5-gtk and fcitx5-configtool. plasma-keyboard is the on-screen keyboard. fcitx5 is built for Wayland only, with no X11 frontend and no systemd. Its build would download data at build time, which the chroot cannot, so the recipe declares the data archive as a second source and build.sh puts it where the download would have written it; libime and the Chinese engine carry their dictionaries the same way. How KWin relays the input method to applications is in Input methods.
KWin and Plasma
The kde section is the session itself. kwin is the compositor and window manager, with Xwayland for X11 clients; kglobalacceld, kscreenlocker, aurorae, knighttime and kscreen are the parts it loads or serves. KWin carries KDOS patches, each with its Subject: line on the kwin page. plasma-workspace is plasmashell, the session’s start and end, KRunner and the notifications, and plasma-desktop the panel and desktop containments and Kickoff; milou is KRunner’s results view, and systemsettings hosts every settings page. The rest of the section is the session’s tools, services and applets: kde-cli-tools, kmenuedit, kactivitymanagerd, kwrited, polkit-kde-agent-1, powerdevil, plasma-nm, plasma-pa, bluedevil, kde-gtk-config, kdeplasma-addons, plasma-browser-integration, discover, sddm-kcm, plasma-setup, plasma-welcome and krohnkite, the auto-tiling script, which is off by default and which the tiling desk turns on. Every one of them is built with its systemd parts turned off or removed, and the classic session start is the only one; the pages say how. How the session starts is in The session.
The sections before kde hold the Plasma pieces that belong to a subject shelf: the system monitor (ksystemstats, plasma-systemmonitor, kinfocenter), plasma-thunderbolt, plasma-disks, plasma-vault, ksshaskpass, the backup tool kup, spectacle and, under xdg, xdg-desktop-portal-kde, the portal backend. xdg-desktop-portal itself was built in Part X. print-manager closes the upstream ports.
KDOS’s own artwork and Plasma code
The src-art and src-desktop sections are KDOS’s own. They are Qt 6 and KDE Frameworks code, QML and generated data, each with an ECM build.sh or a short install, and each page shows it:
- the look: kdos-plasma-look (the eight colour schemes and global themes, the
kdosPlasma style, the three desks), kdos-sddm-theme and kdos-addons, the offline add-on set; - System Settings pages: kcm-kdos-system (the two root slots), kcm-kdos-boxes, kcm-kdos-firewall, kcm-kdos-look and kcm-kdos-health;
- KWin plugins: kdos-kwin-motion, kwin-effect-kdos-keys, kwin-script-kdos-runraise and kwin-script-kdos-window-memory;
- the shell and its services: kdos-welcome, plasmoid-kdos-checklist, plasmoid-kdos-privacy, kded-kdos, kdos-runner, kdos-notice, ksystemstats-kdos, kio-library and kdos-transcribe;
- kdos-discover, the Discover backend for packs, boxes and host ports and the system-update notifier;
- kdos-installer-gui, the graphical installer over the same backend as the terminal one.
What each does once it runs is in The KDOS book: The Plasma shell, KWin, KDOS’s settings and Discover.
The root daemons
The src-daemons section holds KDOS’s own daemons. Six of them run as root: kdos-powerd, kdos-energyd, kdos-oomd, kdos-packd, kdos-settingsd and kdos-sysupdated.
- Each is a small C program compiled with
libkbaseand whatever else it needs, and installed in/usr/sbin. - The two with a command-line client,
kdos-powerdandkdos-energyd, install that client as a link in/usr/bin(kdos-power,kdos-energy) to the same binary. - They share one shape: a root process under
ksvc supervisethat owns a socket in/runor a name on the system bus, and authorises each request by the caller’s credentials or through polkit. That shape is described in The shape they share.
The seventh, kdos-mdnsd, answers .local host names from Avahi. It binds UDP port 5380 on 127.0.0.1 as root, then runs as nobody, and NetworkManager’s dnsmasq forwards the local domain to it (see kdos-mdnsd).
The meta ports
The meta section closes the phase: kde-plasma, the session, and the Gear sets kde-gear-core, kde-gear-games, kde-gear-education, kde-gear-pim, kde-gear-multimedia, kde-gear-graphics, kde-gear-utilities and kde-gear-devtools, then kde-gear and kde-all. A meta port has no source and installs no file; it only names other ports in depends, so kpkg install kde-all gives a machine the whole desktop. Gear is split by kind because kpkg accepts at most 128 ports on one recipe’s depends line.
Changing a desktop program
Every port under src/ that has no source = counts the whole of src/libs as part of its recipe, so an edit to a library makes every one of them out of date, in this phase and in the userland phases that build KDOS’s own programs (see The recipes under src/). The build plan for one program, and the faster loop that puts a rebuilt program into a running image without packaging a new one, are in Rebuilding one thing.
Which ports have full pages
KDOS’s own ports other than kdos-mdnsd, and the core of the session, are Tier A: they have full pages, docs/kfs/data/tier-a.txt names them, and each page carries the hand-written note beside its recipe (see The three tiers). The core of the session here is SDDM, the input method and its engines, KWin, the screen locker, plasma-workspace, plasma-desktop, PowerDevil, Discover and the KDE portal backend. The other ports of the phase, kdos-mdnsd among them, are Tier B or C by the general rule.
See also
- The programs: every program of KDOS’s own and where it is documented
- The session: how the programs built here start and fit together
- Writing desktop software: how KDOS’s Plasma code is written
- Reading a package page: how the pages below are laid out
- Part XIV: the next phase