Created
August 27, 2020 07:02
-
-
Save roylez/be214742d37b9c6a5ffbf8c3087bb700 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
#!/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&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