#!/usr/bin/ruby require 'gconf2' entry = '/desktop/gnome/background/picture_filename' base_dir = File.join(File.expand_path('~'), '.artspots-cache') images = Dir.glob(File.join(base_dir, '*.{jpg,gif,png}')) GConf::Client.default[entry] = images[rand(images.length)]