Last active
November 25, 2022 10:05
-
-
Save axi/d6407efa1e04f27e82189e4cca4bcb81 to your computer and use it in GitHub Desktop.
Set a wallpaper from Le grand bornand webcam
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
#!/bin/bash | |
# | |
# Add a cron job to run this script every 11 minutes. | |
# crontab -e | |
# */11 * * * * /home/YOUR_USER_NAME/script/wallpaper-gnome-grand-bornand-webcam.sh | |
# | |
USER=$(whoami) | |
# Le Grand-Bornand Mont Lachat de Châtillon - 2100 m | |
wall_1[0]='TWYys-vfsKu-ZeRxz-0YTRq' | |
wall_1[1]='0+0' | |
# Le Grand-Bornand Chinaillon - 1300 m | |
wall_2[0]='1vkjM-btDJb-I0RrE-GfIeL' | |
wall_2[1]='6100+0' | |
# Le Grand-Bornand La Taverne - 1550 m | |
wall_3[0]='YDnwI-fqtUr-FsfjN-CoJVy' | |
wall_3[1]='6100+0' | |
wall=("${wall_3[@]}") | |
# Delete cached wallpaper. | |
rm -f /home/$USER/.cache/wallpaper/* | |
# Download image. | |
curl -L -o /tmp/wallpaper-tmp.jpg "https://api.skaping.com/media/getLatest?format=jpg&api_key=${wall[0]}" | |
# crop 12231 x 2160 => 3840x2160 (16/9) | |
mogrify -crop 3840x2160+${wall[1]} /tmp/wallpaper-tmp.jpg | |
convert -font helvetica -fill black -pointsize 40 -gravity SouthEast -draw "text 30,100 '$(date +"%H:%M")'" /tmp/wallpaper-tmp.jpg /tmp/wallpaper-tmp.jpg | |
mv /tmp/wallpaper-tmp.jpg /tmp/wallpaper.jpg | |
# Set new wallpaper ## 'none', 'wallpaper', 'centered', 'scaled', 'stretched', 'zoom', 'spanned' | |
gsettings set org.gnome.desktop.background picture-options "scaled" | |
gsettings set org.gnome.desktop.background picture-uri file:///tmp/wallpaper.jpg |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment