Javascript to change the default wallpaper in plasma

Marco Martin notmart at gmail.com
Thu Jul 28 09:59:34 UTC 2016


On Mon, Jul 25, 2016 at 9:01 PM, Raphael Hertzog <hertzog at debian.org> wrote:
>     d = desktops()
>
>     for (i in d) {
>         d[i].wallpaperPlugin = 'org.kde.image'
>         d[i].currentConfigGroup = Array('Wallpaper', 'org.kde.image', 'General')
>         d[i].writeConfig('Image',
>                 'file:///usr/share/images/desktop-base/desktop-background')
>         d[i].writeConfig('FillMode', '2')          //enables croping
>     }
>
> But it doesn't seem to work and I don't know why. It's possible that the script
> is not executed at all...

the script is correct.
you have to make sure the file actually exists looks suspicious that
does't have an extension, for instance on the local installation here
i have
/opt/kde5qt5/share/wallpapers/ColorfulCups/contents/images/1920x1080.jpg

that means i do:
d[i].writeConfig("Image",
"file:///opt/kde5qt5/share/wallpapers/ColorfulCups/contents/images/1920x1080.jpg");

since it's a wallpaper in the plasma wallpaper format with a kpackage
layout and multiple resolutions, i can do as well:
d[i].writeConfig("Image", "ColorfulCups");

but d[i].writeConfig("Image",
"file:///opt/kde5qt5/share/wallpapers/ColorfulCups") wouldn't work
--
Marco Martin


More information about the Plasma-devel mailing list