Put file names into vars
This commit is contained in:
parent
86c7f53ebc
commit
b087727b70
1 changed files with 9 additions and 3 deletions
12
wallspla.sh
12
wallspla.sh
|
@ -7,6 +7,12 @@ ACCESS_KEY=""
|
||||||
#Comma separated collection ids: https://unsplash.com/collections
|
#Comma separated collection ids: https://unsplash.com/collections
|
||||||
COLLECTIONS=""
|
COLLECTIONS=""
|
||||||
|
|
||||||
|
#Name of the jpg file to use
|
||||||
|
WALLPAPER_LOCATION=~/Images/wallpaper.jpg
|
||||||
|
|
||||||
|
#Name of the info (txt) file
|
||||||
|
INFO_LOCATION=~/Images/wallpaper.txt
|
||||||
|
|
||||||
#Get new random info
|
#Get new random info
|
||||||
photo=$(curl -sf -H "Accept-Version: v1" -H "Authorization: Client-ID ${ACCESS_KEY}" "https://api.unsplash.com/photos/random?featured&orientation=landscape&collections=${COLLECTIONS}&random=${RANDOM}")
|
photo=$(curl -sf -H "Accept-Version: v1" -H "Authorization: Client-ID ${ACCESS_KEY}" "https://api.unsplash.com/photos/random?featured&orientation=landscape&collections=${COLLECTIONS}&random=${RANDOM}")
|
||||||
photo_url=$(echo ${photo} | jq -r ".urls.full")
|
photo_url=$(echo ${photo} | jq -r ".urls.full")
|
||||||
|
@ -14,12 +20,12 @@ photo_location=$(echo ${photo} | jq -r ".location.title")
|
||||||
photo_username=$(echo ${photo} | jq -r ".user.name")
|
photo_username=$(echo ${photo} | jq -r ".user.name")
|
||||||
|
|
||||||
#Download it
|
#Download it
|
||||||
curl -Lsf -o ~/Images/wallpaper.jpg ${photo_url}
|
curl -Lsf -o ${WALLPAPER_LOCATION} ${photo_url}
|
||||||
|
|
||||||
#Set as wallpaper
|
#Set as wallpaper
|
||||||
nitrogen --save --set-zoom ~/Images/wallpaper.jpg
|
nitrogen --save --set-zoom ${WALLPAPER_LOCATION}
|
||||||
|
|
||||||
#Put wallpaper info into text file (eg for Conky)
|
#Put wallpaper info into text file (eg for Conky)
|
||||||
echo "Taken in ${photo_location} by ${photo_username}" > ~/Images/wallpaper.txt
|
echo "Taken in ${photo_location} by ${photo_username}" > ${INFO_LOCATION}
|
||||||
|
|
||||||
# vim:set ts=2 sw=2 et:
|
# vim:set ts=2 sw=2 et:
|
||||||
|
|
Loading…
Reference in a new issue