You are not logged in.

#1 2026-06-05 14:23:45

MAYBL8
Member
From: Florida USA
Registered: 2022-01-14
Posts: 400
Website

trying to script kde plasma wallpaper settings

I will attach the script i am trying to do.
It  is setting the dir but it is not showing images in the preview box and not setting the interval to change the wallpaper.
I used duckduckgo AI to help write the script but it couldn't get me any further.
I was hoping someone here could help.

#!/usr/bin/env bash
set -euo pipefail
WALLPAPER_DIR="${HOME}/.config/variety/Downloaded"
INTERVAL_SECONDS=300
if [[ ! -d "$WALLPAPER_DIR" ]]; then
echo "Directory not found: $WALLPAPER_DIR" >&2
exit 1
fi
SAMPLE_IMAGE=$(find "$WALLPAPER_DIR" -maxdepth 2 -type f -iname '*.jpg' -o -iname '*.jpeg' -o -iname '*.png' | head -n1 || true)
if [[ -z "$SAMPLE_IMAGE" ]]; then
echo "No images found under: $WALLPAPER_DIR" >&2
exit 1
fi
WALLPAPER_URI="file://${WALLPAPER_DIR%/}"
SAMPLE_IMAGE_URI="file://${SAMPLE_IMAGE}"
INTERVAL_MS=$((INTERVAL_SECONDS * 1000))

JS='var all = desktops(); for (var i = 0; i < all.length; i++) { var d = all[i]; d.wallpaperPlugin = "org.kde.slideshow"; d.currentConfigGroup = ["Wallpaper","org.kde.slideshow","General"]; d.writeConfig("SlidePaths", ["'"$WALLPAPER_URI"'"]); d.writeConfig("Recursive", 1); d.writeConfig("Interval", '"$INTERVAL_MS"'); d.writeConfig("Image", "'"$SAMPLE_IMAGE_URI"'"); }'
qdbus org.kde.plasmashell /PlasmaShell org.kde.PlasmaShell.evaluateScript "$(printf '%s' "$JS")"

killall plasmashell || true
kstart5 plasmashell &>/dev/null || true

echo "Set slideshow wallpaper folder to: $WALLPAPER_DIR"
echo "Sample image: $SAMPLE_IMAGE"
echo "Interval: ${INTERVAL_SECONDS}s"

Offline

#2 Yesterday 15:53:18

qinohe
Member
From: Netherlands
Registered: 2012-06-20
Posts: 1,587

Re: trying to script kde plasma wallpaper settings

This is just a heads up, It's not that I'm going to solve that fugly script for you, but did you actually (try and) read it and did it make sense??
My advice don't let AI make your scripts for you if you're unable yourself to verify and check it's output...
One thing I noticed 'qdbus' what is that?, btw that whole loop looks needlessly complicated.
Another thing, are you sure time is stored in milliseconds otherwise 300 * 1000 = 300000 seconds that's a few days
I'd be amazed if anyone's going to solve this for you, go and make something yourself chances are a lot better in that case!
And throw this thing away wink

Offline

#3 Yesterday 20:05:41

MAYBL8
Member
From: Florida USA
Registered: 2022-01-14
Posts: 400
Website

Re: trying to script kde plasma wallpaper settings

Thanks for the help and words of encouragement .

Offline

#4 Today 06:08:01

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 75,801

Re: trying to script kde plasma wallpaper settings

One thing I noticed 'qdbus' what is that?

https://archlinux.org/packages/extra/x86_64/qt5-tools/
https://archlinux.org/packages/extra/x86_64/qt6-tools/ has qdbus6 and qdbus but not in regular $PATH's

This is insane

killall plasmashell || true
kstart5 plasmashell &>/dev/null || true

d.wallpaperPlugin = "org.kde.slideshow"

So apparently there's a slideshow plugin to do the plasma wallpaper?
What's the point of this script?

Offline

#5 Today 12:50:25

MAYBL8
Member
From: Florida USA
Registered: 2022-01-14
Posts: 400
Website

Re: trying to script kde plasma wallpaper settings

seth wrote:

One thing I noticed 'qdbus' what is that?

https://archlinux.org/packages/extra/x86_64/qt5-tools/
https://archlinux.org/packages/extra/x86_64/qt6-tools/ has qdbus6 and qdbus but not in regular $PATH's

This is insane

killall plasmashell || true
kstart5 plasmashell &>/dev/null || true

d.wallpaperPlugin = "org.kde.slideshow"

So apparently there's a slideshow plugin to do the plasma wallpaper?
What's the point of this script?

@Seth

What I am trying to do and I didn't know how to so I tried to get help from AI . Obviously not a good choice.
I am trying to set via archiso the settings in plasma kde to have the wallpaper automatically set to a folder and rotate the images on a set time schedule.
This can be done manually by changing the settings to slideshow and selecting the folder.
I wanted to do it in the archiso and was lost on how to set the settings there. So I was looking for help.
The code AI provided did change the setting to slideshow and had the folder in place but it didn't display the images and the time setting didn't change.
Thanks

Offline

#6 Today 13:19:37

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 75,801

Re: trying to script kde plasma wallpaper settings

You just need to to fix/provide a static config file, there's no need for any runtime script, dbus or restarting plasma.
In doubt change the settings manually as you like them and then copy the config file.

Offline

#7 Today 13:45:13

qinohe
Member
From: Netherlands
Registered: 2012-06-20
Posts: 1,587

Re: trying to script kde plasma wallpaper settings

@seth, thanks for the qdbus answer
@MAYBL8, If you would have said right away what it was your planning to do we could have given that answer right away wink
In case your wondering what file seth is talking about:

.config/plasma-org.kde.plasma.desktop-appletsrc

edit:btw. I have tested this seth but the gets reset on first start so he may need to do some more investigation

Last edited by qinohe (Today 14:04:14)

Offline

#8 Today 15:30:06

MAYBL8
Member
From: Florida USA
Registered: 2022-01-14
Posts: 400
Website

Re: trying to script kde plasma wallpaper settings

qinohe wrote:

@seth, thanks for the qdbus answer
@MAYBL8, If you would have said right away what it was your planning to do we could have given that answer right away wink
In case your wondering what file seth is talking about:

.config/plasma-org.kde.plasma.desktop-appletsrc

edit:btw. I have tested this seth but the gets reset on first start so he may need to do some more investigation

that was going to be my reply. It gets reset.

Offline

#9 Today 17:14:15

qinohe
Member
From: Netherlands
Registered: 2012-06-20
Posts: 1,587

Re: trying to script kde plasma wallpaper settings

Well, hahah I tested this for you and is possible. however which file is the culprit I really don't know!
So I went ahead and copied three directories '.cache .config .local' and this seemed to have worked
Settings done are saved but it's kinda rude solution so it's up to you to figure out which files need to be copied !
Ow and please let us know wink

Offline

#10 Today 17:37:26

ReDress
Member
From: Nairobi
Registered: 2024-11-30
Posts: 300

Re: trying to script kde plasma wallpaper settings

qinohe wrote:

So I went ahead and copied three directories '.cache .config .local' and this seemed to have worked

Yeah, I know. Sounds good but them people living there. It's not empty like it was before.

Offline

#11 Today 17:43:05

MAYBL8
Member
From: Florida USA
Registered: 2022-01-14
Posts: 400
Website

Re: trying to script kde plasma wallpaper settings

qinohe wrote:

Well, hahah I tested this for you and is possible. however which file is the culprit I really don't know!
So I went ahead and copied three directories '.cache .config .local' and this seemed to have worked
Settings done are saved but it's kinda rude solution so it's up to you to figure out which files need to be copied !
Ow and please let us know wink

I really appreciate you doing that .
I have allot of plasma setting files already in the .config folder being set.
Thanks for pointing me in the right directiion.
I will let you know what I find out.

Offline

#12 Today 17:44:32

qinohe
Member
From: Netherlands
Registered: 2012-06-20
Posts: 1,587

Re: trying to script kde plasma wallpaper settings

ReDress wrote:

Yeah, I know. Sounds good but them people living there. It's not empty like it was before.

You're right about that, personally I wouldn't use it this way though usable it is wink

Offline

#13 Today 17:50:46

ReDress
Member
From: Nairobi
Registered: 2024-11-30
Posts: 300

Re: trying to script kde plasma wallpaper settings

qinohe wrote:
ReDress wrote:

Yeah, I know. Sounds good but them people living there. It's not empty like it was before.

You're right about that, personally I wouldn't use it this way though usable it is wink

Yeah, right. It's essentially a money printing machine now.

Offline

Board footer

Powered by FluxBB