View Full Version : [kubuntu] KDE 4 Wallpaper Change Script

May 22nd, 2008, 02:20 PM

Trying to put together a script to change wallpaper under Kubuntu KDE4.


Because I have installed weather-wallpaper (http://mundogeek.net/weather-wallpaper/) and would like to update my wallpaper with the latest wallpaper image generated by the application every hour. I know that the application is supposed to do this itself, but this doesn't work under KDE 4.

Yes I could submit a bug to the author (and probably will do), but I would like learn how to script something for myself in the meantime...

Looked at:
dcop kdesktop KBackgroundIface setWallpaper /tmp/wallpaper1.pngbut get "object not accessible for "kdesktop"

Does anyone know how to scriptomatically change wallpaper in Kubuntu KDE4?

May 22nd, 2008, 03:09 PM
edit: Doh, KDE4, reading comprehension: failed, below poster > me

$ dcop kdesktop KBackgroundIface setWallpaper <desktop number> "path to background" <mode number>

$ dcop kdesktop KBackgroundIface setWallpaper 1 "/usr/share/default_blue.jpg" 6

1 seems to be wallpaper disabled, only background color
2 seems to be wallpaper tiled with first image in top left corner
3 seems to be wallpaper tiled with first image centered
4 seems to be wallpaper centered stretched with proportions kept until one side hits screen, space filled by background color
5 seems to be same as 4, though wallpaper aligned to top left and space after stretching filled by tiling
6 seems to be wallpaper stretched to fit screen (what we all use, hm?)

May 22nd, 2008, 03:09 PM
dcop has changed to dbus in KDE4

Try with to issue 'qdbus' (or is it just dbus, not at home atm) in a terminal and see the choices you have.

May 22nd, 2008, 03:45 PM
edit: Doh, KDE4, reading comprehension: failed, below poster > me

LOL no worries.

dcop has changed to dbus in KDE4

Try with to issue 'qdbus' (or is it just dbus, not at home atm) in a terminal and see the choices you have.

Here's the output:

chris@d600:~$ qdbus

org.kde.plasma looks like a potential winner to me (my limited knowledge is showing again) could be wrong thou..

May 22nd, 2008, 04:03 PM
Still not at home...


qdbus org.kde.plasma
it will give you some more choices... Keep going till you find the right one.

May 22nd, 2008, 04:28 PM
I think I have hit on the right forum; I need some help w/removing images from the background folder, the system one, not the pictures in the active wallpaper folder. There is an image there that I donít want, I donít know if it came by default, ( I donít think so), or if it came with one of the themes, but itís not quite the thing to have on when the boss comes by. I tried to delete it, and it wonít allow it, I tried to open, then remove, and it wonít allow that either, thanks for your help.

May 22nd, 2008, 05:54 PM
I have found this:
method void org.kde.plasma.App.initializeWallpaper()

But running:
qdbus org.kde.plasma /MainApplication org.kde.plasma.App.initializeWallpaper

doesn't do anything :( It just returns me to the console prompt (after a line feed)

Have also installed qdbusviewer which is helping me find the correct setting.. Shame qdbusviewer doesn't have a search function!

May 23rd, 2008, 03:46 PM
hmm kinda confused now. The more I look at this the more confused i get...

May 23rd, 2008, 06:18 PM
I had a look at it, could not find anything useable. Sorry!

I found a file, ~/.kde4/share/config/plasma-applets (I think the name was), it had a reference to the wallpaper. I tried changing that to something else and refresh the desktop, but the wallpaper did not change.

May 30th, 2008, 03:51 PM
Where can I find the current wallpaper for KDE4?

(I can chop it out of a file if it isn't accessable through DBus.)

July 10th, 2008, 02:38 PM

grep 'wallpaper=' ~/.kde4/share/config/plasma-appletsrc | tail --bytes=+11

will return the filename and path to the current walpaper defined in KDE4 plasma.

May 10th, 2009, 05:25 PM
To read current wallpaper

kreadconfig --file plasma-appletsrc --group Containments --group 1 --group Wallpaper --group image --key wallpaper

To set current wallpaper

kwriteconfig --file plasma-appletsrc --group Containments --group 1 --group Wallpaper --group image --key wallpaper <path-to-wallpaper>

However the latter doesn't happen immediately ...

May 10th, 2009, 09:36 PM
However the latter doesn't happen immediately ...

A quick and dirty solution is to forcefully restart plasma :evil:

pkill plasma&&plasma

December 14th, 2009, 01:47 AM
This is horrible!!!

I cannot understand why there is a GUI for something that simply cannot be done at the command line. This is completely breaking the Linux way of implementing things. If all the features would be available through command line the first version of KDE4 that was officially released would've been much more stable!

That was the first thing I learned when I started developing real applications. No test = no release!

KDE4 is a feature hunt just like the windows way!

Just a statement from this topic:


I do not recommend editing the plasma-desktop-appletsrc file, since Plasma never re-reads the file while running, it only writes to it, so your changes will be lost on shutdown.

The correct method of implementing this would be through Plasma's Javascript interface, which is arriving in KDE SC 4.4.


Now I assume those KDE devs are just a mix of script kiddies and web developers paid by google and nokia.

Just some confusing:

If you want to get the config for your wallpaper (on the first desktop):

kreadconfig --file plasma-desktop-appletsrc --group Containments --group 1 --group Wallpaper --group image --key wallpaper

If you are used to multiple heads (like I am - I don't have a system with only one head anymore) this is getting you into trouble, as you have to find the correct group for your other wallpapers. On the system I write this, this is e.g.:

kreadconfig --file plasma-desktop-appletsrc --group Containments --group 16 --group Wallpaper --group image --key wallpaper

Really convenient, don't you think?

Another one: trying to find things via qdbus:

qdbus org.kde.plasma-desktop /MainApplication org.freedesktop.DBus.Properties.GetAll KBackgroundIface

...just gives me this:

Invalid D-BUS interface name 'org.kde.plasma-desktop.PlasmaApp' found while parsing introspection
applicationName: plasma-desktop
cursorFlashTime: 1000
doubleClickInterval: 400
globalStrut: qdbus: I don't know how to display an argument of type '(ii)'
keyboardInputInterval: 400
organizationDomain: kde.org
quitOnLastWindowClosed: true
startDragDistance: 4
startDragTime: 500
wheelScrollLines: 3

So why the hell is it giving me global settings when the thing I asked for is things related to background???

Another thing that drives me crazy is the inability to set a background to span multiple monitors. I always thought the benefit of a new version (including a complete rewrite) was to get more features, more flexibility, faster user experience aso.

If KDE4 development continues like this I will switch over to XFCE. I really like to see those fancy this as well, but if the very basic things don't work I must assume that the whole thing is not to be considered a piece of good software. No wonders why those gnome folks are ROFL-ing the whole day...

Cheers and good luck,


December 14th, 2009, 07:19 AM
But there is a workaround to the main question of this thread.

Just do the following:

create a new folder
write a usual script that copies the wallpaper to use into that folder to exactly ONE filename (e.g. always "picture.jpg")
open "desktop settings"
set type to "slideshow"
set folder to the one just created

This works rather well as long as the KDE devs don't decide to optimize and disable updates in the background if there is only one file in the specified folder.



kung fu buntu
June 24th, 2010, 03:38 PM
Has a real solution been found for this yet?

This is even more problematic because I'm using wallpaper slideshow and conky :(

Why did they had to break something that was working fine?