Files
unsplash_generator/unsplash_generator.sh
T
2024-11-18 21:13:04 +00:00

23 lines
921 B
Bash
Executable File

#!/bin/bash
# Realy simple and easy script for automatic background change of gnome shell screensawer wallpaper
# Install:
# 1. put this script somewhere
# 2. set script executable (chmod +x unsplash.sh)
# 3. add script to your crontab (crontab -e) [0 * * * * YOUR_PATH/unsplash.sh >/dev/null 2>&1]
PWD=$(dirname $(readlink -f $0))
# here are some other ways of downloading wallpaper
#get random photo
url=$(curl https://api.unsplash.com/photos/random\?client_id\=sqNEPALHnwDAScQe7uA-l_1HDYH_XCHgCg3xLha47fA\&count\=1\&query\="tree,stars,nature,sea,weather"| jq -r '.[].urls.full')
#download the file
wget -O $PWD/wallpaper.jpg $url
# setting wallpaper as background for screensaver
# http://youness.net/linux/set-random-wallpapers-unsplash-com-ubuntu
gsettings set org.gnome.desktop.screensaver picture-uri file://$PWD/wallpaper.jpg
gsettings set org.gnome.desktop.background picture-uri file://$PWD/wallpaper.jpg