For example, searching the internet I found the following command that allows me to change the Wallpaper in KDE:
qdbus org.kde.plasmashell /PlasmaShell org.kde.PlasmaShell.evaluateScript 'var allDesktops = desktops(); for (i = 0; i < allDesktops.length; i++) {d = allDesktops[i]; d.wallpaperPlugin = "org.kde.image";d.currentConfigGroup = Array("Wallpaper", "org.kde.image", "General"); d.writeConfig("Image", "file:///path/to/image.png")}'
Ok, it works and I can also use it in python using the dbus module, but if you couldn't find the solution with google or no documentation was available, is there any way to find what servicename, path, method and arguments should be used?
I've tried changing wallpapers from KDE settings with dbus-monitor active but it doesn't show anything useful... only 3 line like this:
clover@Lacia:~$ dbus-monitor
method call time=1690707792.535464 sender=:1.20 -> destination=org.freedesktop.DBus serial=2845 path=/org/freedesktop/DBus; interface=org.freedesktop.DBus; member=AddMatch
string "type='signal',path='/KPackage/Plasma/Wallpaper',interface='org.kde.plasma.kpackage',member='packageInstalled'"
It's possible to inspect various APIs using
qdbusviewertool fromqt-toolspackageFor example, I can click on
showTextmethod to display a message.The CLI command for the same action will be:
You can see that it's essentially the same path that's on the screenshot with
""and"TEST!"being the arguments toshowTextfunction.This command will display a message with "TEST!" text (the first argument is an icon, empty in this case)
In your example with
evaluateScript, it seems that Kwin scripting API is used.