#!/usr/bin/env python # # xkcd.py # Script to download the latest XKCD comic # and place it as your GNOME wallpaper # # Copyright (C) 2010 Shreyank Gupta # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program 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. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . import urllib import json from subprocess import call TMPFILE = "/tmp/xkcd.png" XKCD_URL = "http://xkcd.com/info.0.json" fd = urllib.urlopen(XKCD_URL) url = json.load(fd)['img'] call(["wget", "-O", TMPFILE, url]) call(["gconftool-2", "-t", "str", "--set", "/desktop/gnome/background/picture_options", "centred"]) call(["gconftool-2", "-t", "str", "--set", "/desktop/gnome/background/primary_color", "#ffffffffffff"]) call(["gconftool-2", "-t", "str", "--set", "/desktop/gnome/background/secondary_color", "#ffffffffffff"]) call(["gconftool-2", "-t", "str", "--set", "/desktop/gnome/background/picture_filename", TMPFILE])