Bug 514131 - KWin permanently caches QML files in KWin scripts, making development harder
Summary: KWin permanently caches QML files in KWin scripts, making development harder
Status: CONFIRMED
Alias: None
Product: kwin
Classification: Plasma
Component: scripting (other bugs)
Version First Reported In: 6.5.3
Platform: Bazzite Linux
: NOR wishlist
Target Milestone: ---
Assignee: KWin default assignee
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2026-01-04 00:08 UTC by Gerry Hernandez
Modified: 2026-01-07 14:58 UTC (History)
4 users (show)

See Also:
Latest Commit:
Version Fixed/Implemented In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Gerry Hernandez 2026-01-04 00:08:47 UTC
# SUMMARY

When re-loading a KWin `declarativescript` script during a local development workflow, KWin only loads a cached version of each QML file. After the initial load, any changes to the contents of the QML files are ignored.


# STEPS TO REPRODUCE

I've created a minimal KWin `declarativescript` example, available at https://github.com/gplusplus314/kwin-helloworld complete with reproduction instructions in the `README.md`. Here is a high level reproduction:

1. Create a KWin `declarativescript` with a `main.qml` file that contains a "Hello World" of sorts.
2. Install, enable, and start the script. You will see "Hello World".
3. Disable and uninstall the script.
4. Change the text in `main.qml` to say "Hello KWin".
5. Disable, uninstall, reinstall, reload the script.


# OBSERVED RESULT

"Hello World"

# EXPECTED RESULT

"Hello KWin"

# SOFTWARE/OS VERSIONS

Linux Kernel: 6.17.7-ba22.fc43.x86_64
KDE Plasma Version:  6.5.4
KDE Frameworks Version: 6.21.0
Qt Version: 6.10.1

# ADDITIONAL INFORMATION

I found a similar issue in another project that uses QML and they've resolved it by exposing https://doc.qt.io/qt-6/qqmlengine.html#clearComponentCache in their API. Here is the issue: https://github.com/JuliaGraphics/QML.jl/issues/195

The only workaround I can find to forcefully invalidate the QML cache in KWin is to restart KWin altogether, which is very disruptive.

It would be helpful to either perform a `clearComponentCache` upon unload, or even just expose it via `dbus`, or any other mechanism that would allow us to have a working development loop/workflow for KWin scripts in QML.
Comment 1 David Edmundson 2026-01-05 11:22:45 UTC
Exposing via dbus would be fine. 

Doing anything more automatic would slow down the common user case for a super niche development case.
Calling trimComponentCache on script unload might be ok if that suffices.

---

We should also test how well it works with qmlpreview (https://doc.qt.io/qt-6/qtqml-tooling-qmlpreview.html)

Unfortunately it requires the developer to rebuild kwin once with a flag set, but if it does work it would be even more streamlined for everyone.
Comment 2 David Edmundson 2026-01-05 16:58:45 UTC
update: qmlpreview isn't flexible enough