kde 4.5 - using dual monitor wallpapers in a slideshow
KDE 4.5 does not support spreading a single wallpaper image across dual monitors. Initially, I attempted splitting the wide (3840x1080) images in half, then using KDE’s slideshow to have them both change at the same time; unfortunately, KDE’s slideshow pulls images in a random order.
Eventually I found a solution. Set each KDE desktop to slideshow, pointed at a folder which contains one image. This ensures that the desktop attempts to refresh its background at whatever frequency you set that for. I then wrote a script to select a random image out of a directory of dual monitor backgrounds, cut the image in half, and save the left and right halves to the above “slideshow” directories, overwriting the image that was currently in place. The script runs in my crontab every ten minutes. The KDE desktop refreshes the background every five minutes, so I get a new background sometime around ten minutes.
Now, I can grab images at my leisure from dualmonitorbackgrounds.com and have them automatically split and handled by my slideshow by simply dropping them into a particular directory. Magic!
Here’s the script:
#!/bin/bash
# some setup
WPD=$HOME/.kde/share/wallpapers/dm # directory of wide (3840x1080) images
WWPD=$WPD/tmp # location to store split images
OLWPD=”$WPD/L_USE” # directory the left image should be placed into
ORWPD=”$WPD/R_USE” # directory the right image should be placed into
# select random wallpaper file from WPD
RFN=`/bin/ls -1 “$WPD” | sort —random-sort | grep “.jpg$” | head -1`;
RFP=`readlink —canonicalize “$WPD/$RFN”`;
# split vertical into WWPD
convert $RFP -crop 50%x100% +repage $WWPD/wp_%d.jpg;
CONVERSION_RESULT=`echo $?`;
if [ $CONVERSION_RESULT -eq 0 ]; then
# move left (0) into OLWPD
mv $WWPD/wp_0.jpg $OLWPD/wp.jpg;
# move right (1) into ORWPD
mv $WWPD/wp_1.jpg $ORWPD/wp.jpg;
else
echo “Conversion Failed ($CONVERSION_RESULT)”;
exit 1;
fi;
exit 0;