Jump to content

KDE Linux/Develop KDE software

From KDE Community Wiki
Revision as of 00:26, 7 October 2025 by Ngraham (talk | contribs) (Clarify some things)

There are two primary approaches here: developing KDE software that's shipped on the base image, and developing KDE software that can be built using Flatpak.


KDE software that's shipped on the base image

The best way to do this is by using systemd-sysext, which allows overlaying built-from-source content on top of /usr/ without impacting the base system.

This workflow is used for developing KDE software that's shipped on the base system, or even Qt. A list of such software can be found here. Note that "workspace" includes Plasma, KWin, and Plasma-aligned apps such as System Settings and Discover.

In practice, this workflow should be used to develop all KDE software that's included with KDE Linux, except for a few apps that are shipped as Flatpaks, which can be found here. You can use this for KDE apps that get shipped as Flatpaks, but it's not recommended since the built app will offer a different UX due to no sandboxing.

Setup

Run the setup script:

_kde-linux-set-up-system-development

Use

In a nutshell, you'll compile and install software using kde-builder, then refresh the systemd extension, and then finally restart any services that you changed (e.g. Plasma), or the entire system.

For example, to compile and test a change to plasma-pa, do the following:

kde-builder plasma-pa
sudo systemd-sysext refresh
systemctl restart --user plasma-plasmashell.service

When you're finished developing or testing the change, disable ("un-merge") the system extension:

sudo systemd-sysext unmerge

When you're done with your built-from-source software (e.g. because it was accepted as a patch and merged), delete the installed files:

rm -r ~/kde/usr/*
# When you're prompted to delete the read-only extension-release.kde file, answer 'n'


KDE app with a Flatpak manifest

To develop or test changes to the app code itself, build the app using flatpak-builder, so that the result is functionally identical to the app's nightly Flatpak build.

Note

To develop or test changes to a KDE Framework or other library used by multiple apps, the only relatively painless approach at the moment is to use kde-builder to build them all. See Building KDE software that's shipped on the base image.


Setup

First set up a local repository in your home folder to hold your built-from-source Flatpak apps:

flatpak remote-add --user --if-not-exists flathub-apps-built-locally https://flathub.org/repo/flathub.flatpakrepo

Make changes to just the app

First check out the source code for the KDE app you'd like to build. For example, here with Filelight:

# Create folder to hold KDE source code; skippable if it already exists
mkdir -p ~/kde/src/

# Go into that folder
cd ~/kde/src/

# Download source code for Filelight. Skippable if already done
git clone [email protected]:utilities/filelight.git

# Go into Filelight's source code folder
cd ~/kde/src/filelight

# Build Filelight as a Flatpak
flatpak-builder build --user --install-deps-from=flathub-apps-built-locally --force-clean --ccache --install .flatpak-manifest.json

Now run it:

org.kde.filelight

Note

You may need to make a trivial change to the .flatpak-manifest.json file (e.g. changing the text in "tags:") or else flatpak-builder might not build the app with your changes.

For further information, see:


Any KDE software, using KDE Builder in Distrobox

If you need to work on some KDE software not preinstalled on the base system (so dependencies are also not pre-installed) that also does not or cannot build as a Flatpak, you can build it with kde-builder in a Distrobox:

# As per https://develop.kde.org/docs/getting-started/building/containers-distrobox
distrobox create --image docker.io/archlinux --name kdebuildercontainer --home ~/kdebuildercontainer_home
distrobox enter kdebuildercontainer
sudo pacman -Syu
sudo pacman -S nano
echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.zshrc
exit
distrobox enter kdebuildercontainer

# Install kde-builder as usual. https://develop.kde.org/docs/getting-started/building/kde-builder-setup