Sync wallpaper across multiple screens on KDE

Hello!

Is there a way to sync wallpaper change on both of my displays? I can only set each display separately. I have a folder with wallpapers that I like to rotate every 15 minutes, randomly. If I set it on one screen it doesnt affect the other and I dont see no option to set it on both screens. Im on KDE plasma, using Xorg…

I found this on bugs.kde.org (post 10):

Git commit 07a45c8db3ba2096ac65ff586c63acd20b475f7d by Fushan Wen, on behalf of Prajna Sariputra.
Committed on 09/01/2024 at 10:38.
Pushed by fusionfuture into branch ‘master’.

kcms/wallpaper: Add option to set the same wallpaper for all screens at once

Now that there is a centralized KCM for setting the wallpaper this seemed practical to do, so I gave it a go here. It just enumerates all screens using the same code as the screenIdFromName method and sets the wallpaper for each of them. I don’t have additional displays, so I’m just using the virtual screen created by the screen sharing portal for testing.
FIXED-IN: 6.0

M +18 -1 kcms/wallpaper/ui/main.qml
M +35 -7 kcms/wallpaper/wallpapermodule.cpp
M +6 -0 kcms/wallpaper/wallpapermodule.h

kcms/wallpaper: Add option to set the same wallpaper for all screens at once (07a45c8d) · Commits · Plasma / Plasma Workspace · GitLab

Hope this is of some use! (I always prefer having different wallpapers per monitor so haven’t tested (yet); also the machine I’m on right now doesn’t have another display attached at present).

I’m sorry but I don’t understand any of this… How to implement these changes? What is kcms? Can’t find those files anywhere.

Start System Settings app then select Wallpaper category and check this option:

3 Likes

They are the different configuration modules of the Plasma System Settings.

Can’t believe i didn’t see that toggle button… Thank you.
Can I somehow get them synchronized?

You won’t see the toggle unless the other display(s) is/are active. I just tested this on my other machine; the built-in display is normally turned off.

2 Likes

You can use qdbus, qdbus-qt5 or qdbus6 in a script.

For Python it looks like this:

    def wechsle(self, nummer, datei):
        self.nummer = nummer
        self.datei = datei
        
#        command = ['qdbus', 'org.kde.plasmashell', '/PlasmaShell', 'org.kde.PlasmaShell.evaluateScript']
        command = ['qdbus-qt5', 'org.kde.plasmashell', '/PlasmaShell', 'org.kde.PlasmaShell.evaluateScript']
        command.append("""
                       var allDesktops = desktops();
                       d = allDesktops[%i];
                       d.wallpaperPlugin = "org.kde.image";
                       d.currentConfigGroup = Array("Wallpaper", "org.kde.image", "General");
                       d.writeConfig("Image", "file://%s");
                       """)
        command[-1] = command[-1] % (self.nummer, self.datei)
        subprocess.run(command)

“nummer” is an integer starting with 0
Test which monitor this is.

“datei” is the file name with the whole path.