Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove delay when switching wallpaper in KDE #40

Open
SuhasDissa opened this issue Feb 20, 2022 · 2 comments
Open

Remove delay when switching wallpaper in KDE #40

SuhasDissa opened this issue Feb 20, 2022 · 2 comments

Comments

@SuhasDissa
Copy link

I noticed that you have used a weird method to switch wallpaper in KDE. Which is kinda slow.

kde_cmd() {
    cp ${wallpaper} "${cachedir}/tmp.jpg"
    qdbus org.kde.plasmashell /PlasmaShell org.kde.PlasmaShell.evaluateScript "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:${cachedir}/tmp.jpg\")}"
    qdbus org.kde.plasmashell /PlasmaShell org.kde.PlasmaShell.evaluateScript "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:${wallpaper}\")}"
    sleep 5 && rm "${cachedir}/tmp.jpg"
}

I instead suggest you to use

wallpaper="${cachedir}/${RANDOM}.jpg"

and use this as the KDE function

kde_cmd() {
    qdbus org.kde.plasmashell /PlasmaShell org.kde.PlasmaShell.evaluateScript "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:${wallpaper}\")}"
}

Note that this method will pile up downloaded wallpapers inside cache directory.(which is not too bad)
But theres a way to fix this issue : https://www.howtogeek.com/howto/ubuntu/delete-files-older-than-x-days-on-linux/

@thevinter
Copy link
Owner

The function is built that way because of multi-monitor support. KDE had a glitch where it sometimes wouldn't set the wallpaper for the second desktop. I assume this still works but I'm not familiar with KDE script, can you confirm it still works?

@SuhasDissa
Copy link
Author

Sorry, I don't have multiple monitors right now. But there's an issue switching wallpaper. When I use the same command twice (for the same file path with the new wallpaper) the wallpaper doesn't change even with a single monitor. So that's why I thought to use random name for each wallpaper.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants