A Bash script that switches wallpaper in sync with sunrise and sunset times.
-
Download the shell script file dynamic-wallpaper.sh and save it to the location of your choice (right-click on "Raw" and click "Save Link As...").
-
Make the script file executable using the command:
chmod +x [some/path/]dynamic-wallpaper.sh
-
Open the script file with a text editor. You'll see a section of code labelled
THIS SECTION OF CODE CAN BE EDITED BY THE USER
. Edit this section of code to set your location and your daytime and nighttime wallpapers, then save the file. -
Set the script to run every minute using cron.
- First, ensure that cron is running using the command:
/sbin/service cron start
- Next, set the
EDITOR
environment variable to the text editor of your choice (Leafpad, in this example), as follows:
export EDITOR=leafpad
- Enter the following command to add a new cron task (it will open a file using your chosen text editor):
crontab -e
- Add the following line to the end of the file, then save the file and close the text editor:
* * * * * [some/path/]dynamic-wallpaper.sh
-
dynamic-wallpaper is now installed! If you change locations or wish to set new daytime and nighttime wallpapers, you'll have to make the appropriate edits to the script file.