#!/bin/sh # # Written by Florian Diesch # # Updates may be available at # # # This script is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # You are free to do with it what ever you want. # # version: 2009-11-06 # TMPDIR=$(mktemp -d /tmp/xkcdXXXXXXXXXX) HTML="$TMPDIR/html" PNG="$TMPDIR/xkcd.png" DEST="$HOME/xkcd_wallpaper.png" wget -q -O- http://xkcd.com/|grep -E -i ' "$HTML" URL=$(cut -d\" -f2 "$HTML") TITLE=$(cut -d\" -f4 "$HTML") wget -q -O "$PNG" "$URL" WIDTH=$(identify -format '%w' "$PNG") convert "$PNG" -background '#0008' -fill white -gravity Center -pointsize 30 -size "${WIDTH}" caption:"$TITLE" -append "$DEST" rm -r "$TMPDIR" gconftool-2 --type str --set /desktop/gnome/background/picture_filename "$DEST" gconftool-2 --type str --set /desktop/gnome/background/picture_options "scaled"