How to locally test kwin without breaking my system?

I am interested in developing patches for some kwin bugs (especially https://bugs.kde.org/show_bug.cgi?id=518585).

How do I locally test my patches without breaking my system (just in case something goes slightly wrong, I may end up with no GUI). What procedure do KDE developers use?

I’m not a KDE dev, but… Perhaps testing in a virtual machine would help?

This post answers the question Questions about plasma mobile development - #2 by Herzenschein

I wasn’t sure how to achieve replacing system kwin without breaking the virtual machine :sweat_smile:

I find it most convenient to run kde linux in a VM. See Develop KDE Software - KDE Community

The best thing is it’s based on the latest master code, so you only need to build the project you are working on, not its 100 dependencies.

  1. Install kde-linux in a VM.
  2. Run set-up-system-development
  3. Run updatectl update and reboot to the latest master.
  4. kde-builder --src-only <your project> to fetch the code.
  5. Modify the code. I use vscode remote ssh to connect to the VM and do the editing in host.
  6. kde-builder <your project> to build.
  7. sudo systemd-sysext refresh --always-refresh=yes to overlay binaries you just built to /usr.
  8. kwin --replace to restart kwin.
  9. If you are satisfied with the result, rm -r ~/kde/{usr, etc}/*, reboot, and kbuildsycoca6 --noincremental to reset all binaries back to master.