Skip to content

Instantly share code, notes, and snippets.

@gpessia
Forked from chrismdp/unsplash.sh
Last active August 29, 2015 14:26
Show Gist options
  • Save gpessia/d0aff9d4880ac59501db to your computer and use it in GitHub Desktop.
Save gpessia/d0aff9d4880ac59501db to your computer and use it in GitHub Desktop.
Script to grab one of the 10 more recent images from Unsplash, and tint and blur it for use as an iTerm background using Solarized Dark
#!/bin/bash
# NOTE: requires ImageMagick
# NOTE: will tint to the Solarized Dark default background scheme, as the iTerm background blend option didn't lower the contrast enough for me
# NOTE: Optimised for a 1280x800 point screen (my 13" Retina MBP)
set -e
index=$[ 1 + $[ RANDOM % 10 ]]
img=`curl https://unsplash.com/rss/ | xmllint --xpath '/rss/channel/item['$index']/image/url/text()' -`
curl "$img" > ~/unsplash-latest.jpg &&
/usr/local/bin/mogrify -fill '#002833' -gaussian-blur 0x10 -resize 1280x800^ -extent 1280x800 -colorize 50% ~/unsplash-latest.jpg &&
osascript -e 'tell application "iTerm" to set background image path of current session of current terminal to "'$HOME'/unsplash-latest.jpg"'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment