https://bugs.kde.org/show_bug.cgi?id=170124
Jinesh Choksi <[email protected]> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |[email protected] --- Comment #28 from Jinesh Choksi <[email protected]> --- I saw some one make use of PlasmaShell scripting in a .desktop file to set the desktop wallpaper here: https://discuss.kde.org/t/set-as-desktop-wallpaper-in-gwenview/20550 I adjusted their code to work with KDE 6 and came up with the following set_as_wallpaper.desktop file: ---snip--- [Desktop Entry] Name=Set as wallpaper GenericName=Set as wallpaper Comment=Set any provided image as the desktop wallpaper Exec=/usr/bin/qdbus6 org.kde.plasmashell /PlasmaShell org.kde.PlasmaShell.evaluateScript 'const allDesktops = desktopsForActivity(currentActivity()); 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", "%u"); }' Icon=gwenview Type=Application NoDisplay=true MimeType=image/avif;image/gif;image/heif;image/jpeg;image/jxl;image/png;image/bmp;image/x-eps;image/x-icns;image/x-ico;image/x-portable-bitmap;image/x-portable-graymap;image/x-portable-pixmap;image/x-xbitmap;image/x-xpixmap;image/tiff;image/x-psd;image/x-webp;image/webp;image/x-tga;image/x-xcf;image/openraster;image/svg+xml;image/svg+xml-compressed; ---snip--- Instructions 1. Save the contents above (without the ---snip--- lines) into the following file: ~/.local/share/applications/set_as_wallpaper.desktop. 2. Run "kbuildsycoca6" and ensure it doesn't return any errors. 3. In Gwenview, right click on any image and choose "Open With > Set as wallpaper". I tested this on: KDE Plasma Version: 6.4.4 KDE Frameworks Version: 6.17.0 Qt Version: 6.9.2 ...and it works for me. One bad thing is that for the Exec key, the Desktop Entry Specification says the following regarding using field codes (i.e. %u above) in quoted strings: > Field codes must not be used inside a quoted argument, the result of field > code expansion inside a quoted argument is undefined. > The %F and %U field codes may only be used as an argument on their own. So although it works right now, we can't rely on it working forever. -- You are receiving this mail because: You are watching all bug changes.
