Created
October 31, 2013 20:26
-
-
Save shayelkin/7256499 to your computer and use it in GitHub Desktop.
Download and set the current Bing wallpaper as GNOME wallpaper
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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