Bug 217950

Summary: Ability to set desktop wallpaper via a dbus command
Product: plasmashell Reporter: Evan McLean <ecognito>
Component: Image WallpaperAssignee: Marco Martin <notmart>
Status: RESOLVED FIXED    
Severity: wishlist CC: adam, adaptee, aeoris, aspotashev, bugzilla, caulier.gilles, cfeck, cfox04, ciprianjunca, creideiki+kdebugs, crisr841, devnulll, doublewitt, droserasprout.ext, eda-qa, efelthauser, hooly, indigene2007, jfebrer, john, kde, kolya.ay, lee295012, lyle.tafoya, micah, msylwester, nbs, oldie, plasma-bugs, pulfer, samrog131, sebas, soft, tesfabpel, thomas.pfeiffer, uzix.ls, vamp898, victor.varvariuc, wolfger
Priority: NOR    
Version: 5.3.0   
Target Milestone: 1.0   
Platform: openSUSE RPMs   
OS: Linux   
See Also: https://bugs.kde.org/show_bug.cgi?id=358038
Latest Commit: Version Fixed In:
Bug Depends on:    
Bug Blocks: 170124, 254932    
Attachments: Updated patch to specify screen number
A patch from ROSA & OpenMandriva to set wallpaper via dbus
A patch from ROSA & OpenMandriva for kmozillahelper to set KDE wallpaper from Firefox
A patch from ROSA & OpenMandriva for Firefox to set KDE wallpaper (requires firefox KDE patches from OpenSUSE)
attachment-12901-0.html

Description Evan McLean 2009-12-09 02:26:38 UTC
Version:            (using KDE 4.3.4)
OS:                Linux
Installed from:    openSUSE RPMs

There currently does not appear to be a way to programmatically change the wallpaper image used on the desktop in KDE4. A dbus command would normally be used to do this.
Comment 1 caulier.gilles 2010-10-22 11:08:13 UTC
I agree with this whish. I would to be able to change wall paper through digiKam/kipi-plugins.

Gilles Caulier
Comment 2 Christoph Feck 2010-11-26 20:06:39 UTC
We also need this for bug 257989, or I have to remove that feature :/
Comment 3 Thomas Lindroth 2011-05-05 16:58:39 UTC
*** This bug has been confirmed by popular vote. ***
Comment 4 Alexander Potashev 2011-06-25 22:32:52 UTC
*** Bug 245819 has been marked as a duplicate of this bug. ***
Comment 5 Christoph Feck 2011-07-19 14:49:53 UTC
*** Bug 231574 has been marked as a duplicate of this bug. ***
Comment 6 Christoph Feck 2011-10-03 23:17:32 UTC
*** Bug 283141 has been marked as a duplicate of this bug. ***
Comment 7 Adam Porter 2011-12-21 17:46:55 UTC
This feature is sorely lacking.  It was so easy in KDE 3.  Now people are writing ugly hacks in JavaScript Plasmoids...but all we need is a dbus command that can be called from apps or shells.  Whenever I want to change my wallpaper to one in Digikam, I have to:

1.  Find it in Digikam
2.  Find it in the filesystem
3.  Open the Desktop Settings
4.  Change the wallpaper plugin to Image if it's not already
5.  Click Open
6.  Dig through the fs to find the wallpaper
7.  Click OK

Whereas in KDE 3 it was as simple as:

1.  Find it in Digikam
2.  Click Set As Background
Comment 8 caulier.gilles 2011-12-21 17:51:28 UTC
I'm totally agree with Adam. Why Plasma does not provide this feature already...

Gilles Caulier
Comment 9 caulier.gilles 2011-12-21 18:09:29 UTC
*** Bug 162113 has been marked as a duplicate of this bug. ***
Comment 10 Alexander Potashev 2012-06-24 16:44:21 UTC
See https://git.reviewboard.kde.org/r/105319/
Comment 11 caulier.gilles 2012-07-12 08:26:55 UTC
Can someone can provide the KDE target version where patch from review #105319 will be applied to KDE Plasma API ?

Gilles Caulier
Comment 12 Sebastian Kügler 2012-09-05 21:23:56 UTC
@Gilles Caulier: 4.10.0 most likely.
Comment 13 Gernot Wieprecht 2012-09-22 09:07:22 UTC
Could you also do something like that to change the wallpaper for kspalsh and kdm themes? By now I use the same dirty workaround for changing those as I use for changing the desktop backgrounds for the virtual desktops from a servicemenu: I set those wallpapers to a fixed file which actually is a symlink. So I can change the wallpapers by copying to the file the symlink points to. That works great but only with modified themes. Dbus would be much more flexible.
Comment 14 Evan McLean 2013-07-26 04:33:45 UTC
The last movement on this appears to be three months ago according to https://git.reviewboard.kde.org/r/105319/ and it looked darn close to being ready to ship. Any idea when it might be a go?
Comment 15 Evan McLean 2013-07-26 08:23:04 UTC
Created attachment 81356 [details]
Updated patch to specify screen number

I decided to have a play with the latest patch from https://git.reviewboard.kde.org/r/105319/ so I nutted out how to compile plasma-desktop for my OS (Arch) and started experimenting.

One issue was it did not work as expected for multiple monitor systems. You could not explicitly specify which monitor to update, it would just use whichever had the focus at the time.

So I modified the patch (attached) to add a parameter specifying the screen ID (0, 1, ...).

If you want to play with it, the following dbus-send command will work:

dbus-send --session --dest=org.kde.plasma-desktop --type=method_call --print-reply /App local.PlasmaApp.setWallpaperImage int32:<screenId> string:"<fullPathToImage>"

You could probably make the argument that we should also specify the desktop ID as well. That wouldn't be hard to add in much the same manner I added the screen ID.
Comment 16 Janet 2013-07-26 15:31:08 UTC
Does this also take into account that users might use different widgets = wallpapers for every virtual desktop?
Comment 17 Evan McLean 2013-07-26 22:26:15 UTC
> this also take into account that users might use different
> widgets = wallpapers for every virtual desktop?

I think that's why you would want to add the desktop ID as a parameter as well, as I mentioned.

(I've never done any KDE development before, so have been extrapolating everything from Diff r6.)
Comment 18 Pulfer 2014-02-18 12:37:45 UTC
Created attachment 85214 [details]
A patch from ROSA & OpenMandriva to set wallpaper via dbus
Comment 19 Pulfer 2014-02-18 12:39:16 UTC
Created attachment 85216 [details]
A patch from ROSA & OpenMandriva for kmozillahelper to set KDE wallpaper from Firefox
Comment 20 Pulfer 2014-02-18 12:40:46 UTC
Created attachment 85217 [details]
A patch from ROSA & OpenMandriva for Firefox to set KDE wallpaper (requires firefox KDE patches from OpenSUSE)
Comment 21 Lyle Tafoya 2014-06-03 06:12:20 UTC
I would also find this feature to be very useful. I am developing a wallpaper collage application and it would be nice to provide support for my favorite DE.
Comment 22 jhoo 2014-07-30 06:36:27 UTC
"in KDE 4 it is impossible to change the wallpaper from a program, the only way to do it is through the desktop settings UI."

if dbus is the way to fix this then please make it so.
Comment 23 caulier.gilles 2014-07-30 08:40:37 UTC
Hi Plasma team,

There are few patches in this file to review and nobody seen interrested to implement this standard feature for a desktop...

Why ? It's a regression compared to KDE3.

What's the plan exactly ? Plasma 5 will integrate this usual feature, already implemented in all others desktop, including Windows and OSX ?

Thanks in advance to clarify the status of this entry for the future...

Gilles Caulier
Comment 24 Sebastian Kügler 2014-07-30 11:59:14 UTC
Plasma 4.x has been feature-frozen for well over a year. If this functionality should go in, then it has to be Plasma 5. Patches (via reviewboard) are welcome.
Comment 25 Luc 2014-12-20 15:08:49 UTC
@jhoo +1
Comment 26 Vamp898 2014-12-20 15:50:06 UTC
Wait a second...

This Bug was open for 5 years for Plasma 4 and wasnt been implemented in Plasma 5?

Its not that i want to complain that hard that i want that feature, but does Bugs have to opened for 5 years without getting fixed?

Obviously nobody is interested in applying  the patches for this and none of the maintainers seem to care that hard to fix this, so why is this bug not getting closed as "wontfixed"?

If you look through the open bugs in the KDE Bugtracker, its already a mess in some aspects, i think that developers loose the ability to judge what really is important and should be fixed if so many bugs are left unburied.

If, after 5 years, really nobody cares about fixing this, this should be closed in my opinion (this is not just for this bug, there are a lot of bugs which are opened since years and nobody cares about them).

I hope this is not getting interpreted as an rant. Let an Regression with 317 Votes open for 5 years, which is blocking other bugs, just increases the clutter in the Bugtracker.

In my opinion --> CLOSED AS WONTFIX
Comment 27 Christoph Feck 2014-12-20 16:37:12 UTC
> In my opinion --> CLOSED AS WONTFIX

This is not how the KDE community works.

Please read comment #24. If you do not understand its technical terms, please ask.
Comment 28 Vamp898 2014-12-20 17:07:38 UTC
(In reply to Christoph Feck from comment #27)
> > In my opinion --> CLOSED AS WONTFIX
> 
> This is not how the KDE community works.
> 
> Please read comment #24. If you do not understand its technical terms,
> please ask.

comment 24 was made 5 years after the bug report, my comment have been about the preceding 5 years.
Comment 29 caulier.gilles 2014-12-20 17:29:23 UTC
So if i understand :

- in KDE4, there is no possibility to change desktop wallpaper by a 3rd party application.
- in KF5, perhaps...

Gilles Caulier
Comment 30 Victor Varvaryuk 2014-12-20 17:39:53 UTC
There is a way (https://forum.kde.org/viewtopic.php?f=108&t=119266#p324298), but having an API for this would nice. I also think it's not nice that the devs don't pay attention to user requests. But they are doing this for their fun, so this is it...
Comment 31 Marcus 2014-12-20 22:35:55 UTC
Created attachment 90068 [details]
attachment-12901-0.html

I need removed from this list.

On Sat, Dec 20, 2014 at 12:39 PM, Victor Varvaryuk <
victor.varvariuc@gmail.com> wrote:

> https://bugs.kde.org/show_bug.cgi?id=217950
>
> Victor Varvaryuk <victor.varvariuc@gmail.com> changed:
>
>            What    |Removed                     |Added
>
> ----------------------------------------------------------------------------
>                  CC|                            |
> victor.varvariuc@gmail.com
>
> --- Comment #30 from Victor Varvaryuk <victor.varvariuc@gmail.com> ---
> There is a way (https://forum.kde.org/viewtopic.php?f=108&t=119266#p324298
> ),
> but having an API for this would nice. I also think it's not nice that the
> devs
> don't pay attention to user requests. But they are doing this for their
> fun, so
> this is it...
>
> --
> You are receiving this mail because:
> You voted for the bug.
>
Comment 32 Christoph Feck 2014-12-20 23:03:47 UTC
Marcus, read this mail. It says "You are receiving this mail because: You voted for the bug." at the end.
Comment 33 Janet 2014-12-21 14:00:51 UTC
(In reply to Christoph Feck from comment #27)

> Please read comment #24. If you do not understand its technical terms,
> please ask.

I have a question concerning comment #24: Puffer presented a patch already used by Rosa and Mandriva distribution, see comment #18. So this patch only will be reviewed and taken into consideration if he or someone else puts it into reviewboard?
Comment 34 Sebastian Kügler 2014-12-21 17:06:16 UTC
It looks like the patch is against Plasma 4.x, which is long feature frozen. The patch would need updating and testing against Plasma 5 first, it seems.
Comment 35 Pulfer 2015-04-01 10:16:29 UTC
(In reply to Sebastian Kügler from comment #34)
> It looks like the patch is against Plasma 4.x, which is long feature frozen.
> The patch would need updating and testing against Plasma 5 first, it seems.

It requires almost full rewrite. Plasma 5 internals changed too much, it's no longer possible to use currentContainment->wallpaper()->setUrls(KUrl(url)) because currentContainment->wallpaper() now only returns wallpaper plugin name as QString. And I don't know what to do with this QString.
Comment 36 Vamp898 2015-04-01 10:52:18 UTC
I think this feature worths a full re-write of Plasma. Let us create Plasma 6 with the Main Feature being able to set the Desktop Background using an DBus Command.
Comment 37 indigene 2015-07-15 13:21:22 UTC
Is it true that this is the only Linux DE where the wallpaper can't be changed from a program but only from desktop settings?
Comment 38 caulier.gilles 2015-07-15 13:25:37 UTC
yes it is... Perhaps it's acceptable or not important as nobody working on this feature since a while...
Comment 39 Evan McLean 2016-01-07 05:18:06 UTC
Well, the patch[1] I have been using for the last few years ago is now no good as I've moved to Plasma 5.

Until it is possible to do this via dbus again, I've found a workaround that is acceptable for my use, at least. Thought I would document it here in case anyone else finds it useful:

1. Go to Desktop Settings/Wallpaper for the screen.
2. Change Wallpaper Type to Slideshow.
3. Change timeout to a short value, I use ten seconds.
4. Add a folder that only contains the currently desired wallpaper image.

Then, when you want to change wallpapers, delete the current image in the folder, and move/link[2] the new image. The new image should have a different file name to the previous one.

For more than one screen, do this for each screen, each with its own folder.

Have been using this technique seamlessly for a few weeks now from my wallpaper managing shell script[3].

[1] https://bugs.kde.org/show_bug.cgi?id=217950#c15

[2] Best not to copy the image. The move or linking is (effectively) an atomic operation, whereas the desktop my try to load an incomplete image file while it is being copied.

[3] http://www.michevan.id.au/content/wallpaper-system-info-management-script/ (outdated)
Comment 40 David Edmundson 2016-01-08 13:13:39 UTC
FWIW I wrote something that does this a while ago: https://git.reviewboard.kde.org/r/125648/

not merged yet
Comment 41 Thomas Pfeiffer 2016-03-28 14:32:37 UTC
(this bug report has nothing to do with visual design, it's a purely technical feature implemented on a purely technical level. Not our turf)
Comment 42 David Edmundson 2016-05-03 11:01:42 UTC
Git commit 903cbfd7e267a4812a6ec222eb7e1b5dd775686f by David Edmundson.
Committed on 03/05/2016 at 11:01.
Pushed by davidedmundson into branch 'master'.

Add method to run a script from DBus directly

loadScriptInInteractiveConsole requires user interaction which blocks
some purposes, like setting the desktop background from an app.

This runs a given script directly from a passed string without any
prompts.
REVIEW: 125648

M  +3    -0    shell/dbus/org.kde.PlasmaShell.xml
M  +25   -0    shell/shellcorona.cpp
M  +4    -1    shell/shellcorona.h

http://commits.kde.org/plasma-workspace/903cbfd7e267a4812a6ec222eb7e1b5dd775686f
Comment 43 David Edmundson 2016-05-04 12:47:17 UTC
Don't know why I didn't close this.

See snippit in the review request.
Comment 44 Evan McLean 2016-05-10 08:07:54 UTC
Any chance of an example of how to use this? Say, from the command line with dbus-send?
Comment 45 Rog131 2016-05-10 11:34:01 UTC
(In reply to Evan McLean from comment #44)
> Any chance of an example of how to use this? Say, from the command line with
> dbus-send?

Working at here with the Arch Linux patched plasma-workspace-5.6.3 -> test examples at: https://www.kubuntuforums.net/showthread.php?66762-Right-click-wallpaper-changer&p=387392&viewfull=1#post387392
Comment 46 Kai Uwe Broulik 2016-07-03 12:05:40 UTC
*** Bug 365029 has been marked as a duplicate of this bug. ***
Comment 47 Josep Febrer 2016-11-09 21:55:37 UTC
One thing I don't understand is why it only works when the widgets aren't locked.
When the widgets are locked in Plasma, you are able to change the wallpaper with the desktop settings, so I think by coherence it should be able to change the wallpaper with dbus even if the widgets are locked.
Comment 48 devnulll 2017-02-11 21:29:35 UTC
 I would like also to know how to get it working even if the widgets are locked.