Bug 394409 - "Reloading" wallpaper from script
Summary: "Reloading" wallpaper from script
Status: RESOLVED WORKSFORME
Alias: None
Product: plasmashell
Classification: Plasma
Component: Image & Slideshow wallpaper plugins (show other bugs)
Version: 5.12.4
Platform: Arch Linux Linux
: NOR normal
Target Milestone: 1.0
Assignee: Marco Martin
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-05-18 12:40 UTC by Deleted User
Modified: 2018-05-22 06:56 UTC (History)
3 users (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Deleted User 2018-05-18 12:40:44 UTC
Action
------

1. Save a random image as "~/test.png".

2. Run the following Plasma Shell script:

    var allDesktops = desktops();
    print (allDesktops);
    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:///home/USERNAME/test.png");
    }

3. We see that it changes the wallpaper.

4. Download another random image as "~/test.png", replacing the old one.

5. Run above script again.



Expected Behaviour
------------------

The wallpaper is changed, i.e. Plasma reloads the wallpaper.



Actual Behaviour
----------------

The wallpaper is the same as the original "~/test.png", and not the new one.
Comment 1 Rex Dieter 2018-05-18 18:21:15 UTC
I suspect one possibility this doesn't work is because the config doesn't actually change, so it's not reloaded.

If so, a workaround is to use a differently named file each time, that should help ensure that 'writeConfig' actually changes
Comment 2 David Edmundson 2018-05-21 08:44:05 UTC
>        d.writeConfig("Image", "file:///home/USERNAME/test.png");

That as Rex says, will just no-op. Changing that is not an option.

However, we can agree there should be 



Does 

writeConfg("Image", "")
writeConfg("Image", "file://blah")


work? 

It'll be only one sync.

Failing that maybe we can look at putting file watching into the wallpaper.
Comment 3 Deleted User 2018-05-21 17:18:57 UTC
Yes, that seems to work. Thank you.


File watching for the wallpaper would be an interesting course of action, but I think that'll just spend additional system resources for little benefit. Unless there's a non-polling, easy-on-disk/cpu-usage file watching solution that exists?

Perhaps we could just have Plasma reload the wallpaper image every (configurable) N seconds?


Notes
-----

If one sets the image to a non-existent one, inaccessible one, or just an empty string as given above, Plasma simply keeps using the wallpaper it had previously, until a valid image is set.

I haven't tested what happens if you delete the image set as wallpaper, and then restart the computer or log-out-log-in. Probably a blank wallpaper will be displayed.
Comment 4 David Edmundson 2018-05-21 17:24:32 UTC
Cool, can I close this?
Comment 5 Deleted User 2018-05-22 03:00:11 UTC
Yes, please close it now.
Comment 6 Christoph Feck 2018-05-22 06:56:14 UTC
Thanks for the update; closing.