Skip to content

Instantly share code, notes, and snippets.

@roylez
Created August 27, 2020 07:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save roylez/be214742d37b9c6a5ffbf8c3087bb700 to your computer and use it in GitHub Desktop.
Save roylez/be214742d37b9c6a5ffbf8c3087bb700 to your computer and use it in GitHub Desktop.
#!/bin/zsh
# clean up
rm -rf ~/Downloads/wallpaper*.jpg
# <div class="img_cont" style="background-image: url(/th?id=OHR.SpeedFlying_EN-AU4701306692_1920x1080.jpg&amp;rf=LaDigue_1920x1080.jpg)">
URL=https://bing.com
img=$HOME/Downloads/wallpaper-$(date +%Y%m%d).jpg
img_path=$( curl --silent -L $URL | sed -n 's:.*rel="preload" *href="\(/th[^&]*.jpg\)&.*:\1:p' )
img_url=${URL}${img_path}
curl --silent -L -o $img "${img_url}"
# set wallpaper
osascript -e "tell application \"System Events\" to tell every desktop to set picture to \"$img\""
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment