Skip to content

Instantly share code, notes, and snippets.

@shayelkin
Created October 31, 2013 20:26
Show Gist options
  • Save shayelkin/7256499 to your computer and use it in GitHub Desktop.
Save shayelkin/7256499 to your computer and use it in GitHub Desktop.
Download and set the current Bing wallpaper as GNOME wallpaper
#!/usr/bin/env ruby
OUT_FILE = "#{ENV['HOME']}/Pictures/BingWallpaper.jpg"
require 'open-uri'
f = open('http://www.bing.com/HPImageArchive.aspx?format=xml&idx=1&n=1&mkt=en-US')
s = f.read
img_base = s.match('<urlBase>(.*)</urlBase>').captures[0]
img_url = 'http://www.bing.com/' + img_base + '_1920x1200.jpg'
`wget -O #{OUT_FILE} #{img_url}`
`gsettings set org.gnome.desktop.background picture-uri "file://#{OUT_FILE}"`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment