Thanks!
Now, thinking about this there’s broader scope of plasma scripting which kwin scripting is a subset of. I’m not sure if there should be both kwin-scripting and plasma-scripting or only the latter one would be enough?
Hmm, probably but it seems like overkill, no?
Btw, running simply plasmashell & does not disconnect process from tty so the output is seen in the console… I guess restarting plasma should make use of systemd units nowadays?
I enter ‘prestart’ command in krunner which executes script systemctl --user restart plasma-plasmashell.service which is bound to a secret keyboard shortcut Yes, well it’s secret… don’t be nosy!
I did a quick test with the following script (installed with kpackagetool6 -t KWin/Script -i .):
function mytest() {
print("x");
}
registerShortcut("MyTest", "Test", "Meta+R", mytest);
and after making a change to the installed code at /home/me/.local/share/kwin/scripts/testscript/contents/code/main.js and restarting plasmashell the change does not make effect so restarting plasmashell does not reload KWin scripts.
KWin’s internal D-Bus API, not prominently documented in official user-facing KDE documentation.
qdbus is mostly a workaround for developers who want to reload scripts without restarting KWin or logging out… considered ‘internal’ and used by the KWin Script KCM module in settings.
I remember I used to employ ’ kwin_x11 --replace or kwin_wayland --replace - basically restarting KWin entirely if scripts misbehave (previously a top feature of Krohnkite )
Hello from the future! I can’t get Plasma/KWin to reload my KWin script unless I restart KWin itself. The only way to get KWin to read/run any code updates is to restart it via kwin_wayland --replace &. This is horrible as it then closes all my applications, so productivity slows to near-zero.
This is my justfile, which is similar to a Makefile:
Try unloading the just-reinstalled[1] script before starting it (rather than unloading the “old” script before the kpackagetool6 call that re/installs it).
It’s just not working for me at all. I’ve created a minimal example that demos the exact problem and I’ve put it on GitHub, but the forum won’t allow me to post a link. If you search for the project kwin-helloworld on GitHub, I believe it’s the only one.
Sorry for back to back replies, but I can’t edit my previous comment. I’ve concluded that this is a bug in the way KWin handles loading/unloading of QML scripts, or as KWin calls it declarativescript. The underlying QML engine has built in caching based on filename and requires a call to https://doc.qt.io/qt-6/qqmlengine.html#clearComponentCache in order to invalidate the cache, but it seems like this is never being called by KWin.