Xfce: auto rotate wallpaper without cron

Since Xfce 4.6 I’ve had the wallpaper autorotated on my Xfce desktop with the help of a small script and cron. But after an update of some component (probably libxfconf / xfconf) my script did not work anymore and I got this error if I tried to run the script from a console or via ssh:

** (process:4150): CRITICAL **: Failed to init libxfconf: Failed to connect to socket /tmp/dbus-xrIvHB4Jas: Connection refused

So I made a workaround that did not require cron, and it runs in the current session. I created a .desktop file in ~/.config/autostart with this content:

[Desktop Entry]
Encoding=UTF-8
Version=0.9.4
Type=Application
Name=Rotate bg
Comment=
Exec=/home/enrique/bin/xfce-rotatebg.sh &
StartupNotify=false
Terminal=false
Hidden=false

And the content of the xfce-rotatebg.sh is:

#!/bin/sh
while true; do
PROPERTY="/backdrop/screen0/monitor0/image-path"
IMAGE_PATH=`xfconf-query -c xfce4-desktop -p ${PROPERTY}`
xfconf-query -c xfce4-desktop -p ${PROPERTY} -s ""
xfconf-query -c xfce4-desktop -p ${PROPERTY} -s "${IMAGE_PATH}"
sleep 600
done

The sleep command controls the delay between wallpaper changes.

Remember this only works if you have created a list of wallpapers in the desktop settings of Xfce.

Leave a comment

(required)
(required) (will not be published)

(Comment moderation is in use. Please do not submit your comment twice)