Created
October 7, 2016 21:53
-
-
Save qykong/02634a9768dc8c32f2d6555d9a757059 to your computer and use it in GitHub Desktop.
Automatically change wallpapers for xfce downloading from bing
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 bash | |
PICTURE_DIR="$HOME/Pictures/bing-wallpapers/" | |
mkdir -p $PICTURE_DIR | |
urls=( $(curl -s http://www.bing.com | \ | |
grep -Eo "url:'.*?'" | \ | |
sed -e "s/url:'\([^']*\)'.*/http:\/\/bing.com\1/" | \ | |
sed -e "s/\\\//g") ) | |
for p in ${urls[@]}; do | |
filename=$(echo $p|sed -e "s/.*\/\(.*\)/\1/") | |
if [ ! -f $PICTURE_DIR/$filename ]; then | |
echo "Downloading: $filename ..." | |
curl -Lo "$PICTURE_DIR/$filename" $p | |
#xfconf-query -c xfce4-desktop -p /backdrop/screen0/monitor0/workspace0/last-image -s $PICTURE_DIR$filename | |
xfconf-query -c xfce4-desktop -p /backdrop/screen0/monitor0/workspace0/last-image -s $PICTURE_DIR$filename | |
else | |
echo "Skipping: $filename ..." | |
xfconf-query -c xfce4-desktop -p /backdrop/screen0/monitor0/workspace0/last-image -s $PICTURE_DIR$filename | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment