Skip to content

Instantly share code, notes, and snippets.

@xergio
Created January 24, 2012 09:35
Show Gist options
  • Save xergio/1669263 to your computer and use it in GitHub Desktop.
Save xergio/1669263 to your computer and use it in GitHub Desktop.
Desktop background rotation in XFCE4 + Wallbase.cc
#!/bin/bash
# 1. put this file in a cron job
# 2. then, setup your desktop preferences to use the $BACKDROP image list
DESKTOPS=2
SAVE_TO="/home/salvarez/tmp/wp"
BACKDROP="/home/salvarez/tmp/xfce4-backdrop.list"
export DISPLAY=:0.0;
rm -rf "$SAVE_TO"
mkdir -p $SAVE_TO
I=0
echo "# xfce backdrop list" > $BACKDROP
for URL in `curl --no-buffer --silent --data 'query=landscape&board=23&nsfw=110&res=1920x1080&res_opt=eqeq&aspect=1.77&orderby=random&orderby_opt=desc&thpp=20&section=wallpapers' --user-agent 'http://wallbase.cc/search' http://wallbase.cc/search | grep -i "http:" | grep "drg_thumb" | sed 's/^.*<a href="//' | sed 's/".*$//' | head -n $DESKTOPS`
do
IMG=`curl --no-buffer --silent --user-agent 'http://wallbase.cc/search' $URL | grep "img" | grep "landscape" | sed 's/^.*<img src="//' | sed 's/".*$//'`
wget --quiet --no-directories --directory-prefix="$SAVE_TO/" --referer="$URL" $IMG
echo "$SAVE_TO/`basename $IMG`" >> $BACKDROP
let I=$I+1
done
/usr/bin/xfdesktop --reload
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment